Definition.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\DependencyInjection;
  11. use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
  12. use Symfony\Component\DependencyInjection\Exception\OutOfBoundsException;
  13. /**
  14. * Definition represents a service definition.
  15. *
  16. * @author Fabien Potencier <fabien@symfony.com>
  17. */
  18. class Definition
  19. {
  20. private $class;
  21. private $file;
  22. private $factory;
  23. private $factoryClass;
  24. private $factoryMethod;
  25. private $factoryService;
  26. private $shared = true;
  27. private $deprecated = false;
  28. private $deprecationTemplate = 'The "%service_id%" service is deprecated. You should stop using it, as it will soon be removed.';
  29. private $scope = ContainerInterface::SCOPE_CONTAINER;
  30. private $properties = array();
  31. private $calls = array();
  32. private $configurator;
  33. private $tags = array();
  34. private $public = true;
  35. private $synthetic = false;
  36. private $abstract = false;
  37. private $synchronized = false;
  38. private $lazy = false;
  39. private $decoratedService;
  40. private $autowired = false;
  41. private $autowiringTypes = array();
  42. protected $arguments;
  43. /**
  44. * Constructor.
  45. *
  46. * @param string|null $class The service class
  47. * @param array $arguments An array of arguments to pass to the service constructor
  48. */
  49. public function __construct($class = null, array $arguments = array())
  50. {
  51. $this->class = $class;
  52. $this->arguments = $arguments;
  53. }
  54. /**
  55. * Sets a factory.
  56. *
  57. * @param string|array $factory A PHP function or an array containing a class/Reference and a method to call
  58. *
  59. * @return Definition The current instance
  60. */
  61. public function setFactory($factory)
  62. {
  63. if (is_string($factory) && strpos($factory, '::') !== false) {
  64. $factory = explode('::', $factory, 2);
  65. }
  66. $this->factory = $factory;
  67. return $this;
  68. }
  69. /**
  70. * Gets the factory.
  71. *
  72. * @return string|array The PHP function or an array containing a class/Reference and a method to call
  73. */
  74. public function getFactory()
  75. {
  76. return $this->factory;
  77. }
  78. /**
  79. * Sets the name of the class that acts as a factory using the factory method,
  80. * which will be invoked statically.
  81. *
  82. * @param string $factoryClass The factory class name
  83. *
  84. * @return Definition The current instance
  85. *
  86. * @deprecated since version 2.6, to be removed in 3.0.
  87. */
  88. public function setFactoryClass($factoryClass)
  89. {
  90. @trigger_error(sprintf('%s(%s) is deprecated since version 2.6 and will be removed in 3.0. Use Definition::setFactory() instead.', __METHOD__, $factoryClass), E_USER_DEPRECATED);
  91. $this->factoryClass = $factoryClass;
  92. return $this;
  93. }
  94. /**
  95. * Gets the factory class.
  96. *
  97. * @return string|null The factory class name
  98. *
  99. * @deprecated since version 2.6, to be removed in 3.0.
  100. */
  101. public function getFactoryClass($triggerDeprecationError = true)
  102. {
  103. if ($triggerDeprecationError) {
  104. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0.', E_USER_DEPRECATED);
  105. }
  106. return $this->factoryClass;
  107. }
  108. /**
  109. * Sets the factory method able to create an instance of this class.
  110. *
  111. * @param string $factoryMethod The factory method name
  112. *
  113. * @return Definition The current instance
  114. *
  115. * @deprecated since version 2.6, to be removed in 3.0.
  116. */
  117. public function setFactoryMethod($factoryMethod)
  118. {
  119. @trigger_error(sprintf('%s(%s) is deprecated since version 2.6 and will be removed in 3.0. Use Definition::setFactory() instead.', __METHOD__, $factoryMethod), E_USER_DEPRECATED);
  120. $this->factoryMethod = $factoryMethod;
  121. return $this;
  122. }
  123. /**
  124. * Sets the service that this service is decorating.
  125. *
  126. * @param null|string $id The decorated service id, use null to remove decoration
  127. * @param null|string $renamedId The new decorated service id
  128. * @param int $priority The priority of decoration
  129. *
  130. * @return Definition The current instance
  131. *
  132. * @throws InvalidArgumentException In case the decorated service id and the new decorated service id are equals.
  133. */
  134. public function setDecoratedService($id, $renamedId = null, $priority = 0)
  135. {
  136. if ($renamedId && $id == $renamedId) {
  137. throw new \InvalidArgumentException(sprintf('The decorated service inner name for "%s" must be different than the service name itself.', $id));
  138. }
  139. if (null === $id) {
  140. $this->decoratedService = null;
  141. } else {
  142. $this->decoratedService = array($id, $renamedId, (int) $priority);
  143. }
  144. return $this;
  145. }
  146. /**
  147. * Gets the service that decorates this service.
  148. *
  149. * @return null|array An array composed of the decorated service id, the new id for it and the priority of decoration, null if no service is decorated
  150. */
  151. public function getDecoratedService()
  152. {
  153. return $this->decoratedService;
  154. }
  155. /**
  156. * Gets the factory method.
  157. *
  158. * @return string|null The factory method name
  159. *
  160. * @deprecated since version 2.6, to be removed in 3.0.
  161. */
  162. public function getFactoryMethod($triggerDeprecationError = true)
  163. {
  164. if ($triggerDeprecationError) {
  165. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0.', E_USER_DEPRECATED);
  166. }
  167. return $this->factoryMethod;
  168. }
  169. /**
  170. * Sets the name of the service that acts as a factory using the factory method.
  171. *
  172. * @param string $factoryService The factory service id
  173. *
  174. * @return Definition The current instance
  175. *
  176. * @deprecated since version 2.6, to be removed in 3.0.
  177. */
  178. public function setFactoryService($factoryService, $triggerDeprecationError = true)
  179. {
  180. if ($triggerDeprecationError) {
  181. @trigger_error(sprintf('%s(%s) is deprecated since version 2.6 and will be removed in 3.0. Use Definition::setFactory() instead.', __METHOD__, $factoryService), E_USER_DEPRECATED);
  182. }
  183. $this->factoryService = $factoryService;
  184. return $this;
  185. }
  186. /**
  187. * Gets the factory service id.
  188. *
  189. * @return string|null The factory service id
  190. *
  191. * @deprecated since version 2.6, to be removed in 3.0.
  192. */
  193. public function getFactoryService($triggerDeprecationError = true)
  194. {
  195. if ($triggerDeprecationError) {
  196. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0.', E_USER_DEPRECATED);
  197. }
  198. return $this->factoryService;
  199. }
  200. /**
  201. * Sets the service class.
  202. *
  203. * @param string $class The service class
  204. *
  205. * @return Definition The current instance
  206. */
  207. public function setClass($class)
  208. {
  209. $this->class = $class;
  210. return $this;
  211. }
  212. /**
  213. * Gets the service class.
  214. *
  215. * @return string|null The service class
  216. */
  217. public function getClass()
  218. {
  219. return $this->class;
  220. }
  221. /**
  222. * Sets the arguments to pass to the service constructor/factory method.
  223. *
  224. * @param array $arguments An array of arguments
  225. *
  226. * @return Definition The current instance
  227. */
  228. public function setArguments(array $arguments)
  229. {
  230. $this->arguments = $arguments;
  231. return $this;
  232. }
  233. public function setProperties(array $properties)
  234. {
  235. $this->properties = $properties;
  236. return $this;
  237. }
  238. public function getProperties()
  239. {
  240. return $this->properties;
  241. }
  242. public function setProperty($name, $value)
  243. {
  244. $this->properties[$name] = $value;
  245. return $this;
  246. }
  247. /**
  248. * Adds an argument to pass to the service constructor/factory method.
  249. *
  250. * @param mixed $argument An argument
  251. *
  252. * @return Definition The current instance
  253. */
  254. public function addArgument($argument)
  255. {
  256. $this->arguments[] = $argument;
  257. return $this;
  258. }
  259. /**
  260. * Sets a specific argument.
  261. *
  262. * @param int $index
  263. * @param mixed $argument
  264. *
  265. * @return Definition The current instance
  266. *
  267. * @throws OutOfBoundsException When the replaced argument does not exist
  268. */
  269. public function replaceArgument($index, $argument)
  270. {
  271. if ($index < 0 || $index > count($this->arguments) - 1) {
  272. throw new OutOfBoundsException(sprintf('The index "%d" is not in the range [0, %d].', $index, count($this->arguments) - 1));
  273. }
  274. $this->arguments[$index] = $argument;
  275. return $this;
  276. }
  277. /**
  278. * Gets the arguments to pass to the service constructor/factory method.
  279. *
  280. * @return array The array of arguments
  281. */
  282. public function getArguments()
  283. {
  284. return $this->arguments;
  285. }
  286. /**
  287. * Gets an argument to pass to the service constructor/factory method.
  288. *
  289. * @param int $index
  290. *
  291. * @return mixed The argument value
  292. *
  293. * @throws OutOfBoundsException When the argument does not exist
  294. */
  295. public function getArgument($index)
  296. {
  297. if ($index < 0 || $index > count($this->arguments) - 1) {
  298. throw new OutOfBoundsException(sprintf('The index "%d" is not in the range [0, %d].', $index, count($this->arguments) - 1));
  299. }
  300. return $this->arguments[$index];
  301. }
  302. /**
  303. * Sets the methods to call after service initialization.
  304. *
  305. * @param array $calls An array of method calls
  306. *
  307. * @return Definition The current instance
  308. */
  309. public function setMethodCalls(array $calls = array())
  310. {
  311. $this->calls = array();
  312. foreach ($calls as $call) {
  313. $this->addMethodCall($call[0], $call[1]);
  314. }
  315. return $this;
  316. }
  317. /**
  318. * Adds a method to call after service initialization.
  319. *
  320. * @param string $method The method name to call
  321. * @param array $arguments An array of arguments to pass to the method call
  322. *
  323. * @return Definition The current instance
  324. *
  325. * @throws InvalidArgumentException on empty $method param
  326. */
  327. public function addMethodCall($method, array $arguments = array())
  328. {
  329. if (empty($method)) {
  330. throw new InvalidArgumentException(sprintf('Method name cannot be empty.'));
  331. }
  332. $this->calls[] = array($method, $arguments);
  333. return $this;
  334. }
  335. /**
  336. * Removes a method to call after service initialization.
  337. *
  338. * @param string $method The method name to remove
  339. *
  340. * @return Definition The current instance
  341. */
  342. public function removeMethodCall($method)
  343. {
  344. foreach ($this->calls as $i => $call) {
  345. if ($call[0] === $method) {
  346. unset($this->calls[$i]);
  347. break;
  348. }
  349. }
  350. return $this;
  351. }
  352. /**
  353. * Check if the current definition has a given method to call after service initialization.
  354. *
  355. * @param string $method The method name to search for
  356. *
  357. * @return bool
  358. */
  359. public function hasMethodCall($method)
  360. {
  361. foreach ($this->calls as $call) {
  362. if ($call[0] === $method) {
  363. return true;
  364. }
  365. }
  366. return false;
  367. }
  368. /**
  369. * Gets the methods to call after service initialization.
  370. *
  371. * @return array An array of method calls
  372. */
  373. public function getMethodCalls()
  374. {
  375. return $this->calls;
  376. }
  377. /**
  378. * Sets tags for this definition.
  379. *
  380. * @param array $tags
  381. *
  382. * @return Definition the current instance
  383. */
  384. public function setTags(array $tags)
  385. {
  386. $this->tags = $tags;
  387. return $this;
  388. }
  389. /**
  390. * Returns all tags.
  391. *
  392. * @return array An array of tags
  393. */
  394. public function getTags()
  395. {
  396. return $this->tags;
  397. }
  398. /**
  399. * Gets a tag by name.
  400. *
  401. * @param string $name The tag name
  402. *
  403. * @return array An array of attributes
  404. */
  405. public function getTag($name)
  406. {
  407. return isset($this->tags[$name]) ? $this->tags[$name] : array();
  408. }
  409. /**
  410. * Adds a tag for this definition.
  411. *
  412. * @param string $name The tag name
  413. * @param array $attributes An array of attributes
  414. *
  415. * @return Definition The current instance
  416. */
  417. public function addTag($name, array $attributes = array())
  418. {
  419. $this->tags[$name][] = $attributes;
  420. return $this;
  421. }
  422. /**
  423. * Whether this definition has a tag with the given name.
  424. *
  425. * @param string $name
  426. *
  427. * @return bool
  428. */
  429. public function hasTag($name)
  430. {
  431. return isset($this->tags[$name]);
  432. }
  433. /**
  434. * Clears all tags for a given name.
  435. *
  436. * @param string $name The tag name
  437. *
  438. * @return Definition
  439. */
  440. public function clearTag($name)
  441. {
  442. unset($this->tags[$name]);
  443. return $this;
  444. }
  445. /**
  446. * Clears the tags for this definition.
  447. *
  448. * @return Definition The current instance
  449. */
  450. public function clearTags()
  451. {
  452. $this->tags = array();
  453. return $this;
  454. }
  455. /**
  456. * Sets a file to require before creating the service.
  457. *
  458. * @param string $file A full pathname to include
  459. *
  460. * @return Definition The current instance
  461. */
  462. public function setFile($file)
  463. {
  464. $this->file = $file;
  465. return $this;
  466. }
  467. /**
  468. * Gets the file to require before creating the service.
  469. *
  470. * @return string|null The full pathname to include
  471. */
  472. public function getFile()
  473. {
  474. return $this->file;
  475. }
  476. /**
  477. * Sets if the service must be shared or not.
  478. *
  479. * @param bool $shared Whether the service must be shared or not
  480. *
  481. * @return Definition The current instance
  482. */
  483. public function setShared($shared)
  484. {
  485. $this->shared = (bool) $shared;
  486. return $this;
  487. }
  488. /**
  489. * Whether this service is shared.
  490. *
  491. * @return bool
  492. */
  493. public function isShared()
  494. {
  495. return $this->shared;
  496. }
  497. /**
  498. * Sets the scope of the service.
  499. *
  500. * @param string $scope Whether the service must be shared or not
  501. *
  502. * @return Definition The current instance
  503. *
  504. * @deprecated since version 2.8, to be removed in 3.0.
  505. */
  506. public function setScope($scope, $triggerDeprecationError = true)
  507. {
  508. if ($triggerDeprecationError) {
  509. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  510. }
  511. if (ContainerInterface::SCOPE_PROTOTYPE === $scope) {
  512. $this->setShared(false);
  513. }
  514. $this->scope = $scope;
  515. return $this;
  516. }
  517. /**
  518. * Returns the scope of the service.
  519. *
  520. * @return string
  521. *
  522. * @deprecated since version 2.8, to be removed in 3.0.
  523. */
  524. public function getScope($triggerDeprecationError = true)
  525. {
  526. if ($triggerDeprecationError) {
  527. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  528. }
  529. return $this->scope;
  530. }
  531. /**
  532. * Sets the visibility of this service.
  533. *
  534. * @param bool $boolean
  535. *
  536. * @return Definition The current instance
  537. */
  538. public function setPublic($boolean)
  539. {
  540. $this->public = (bool) $boolean;
  541. return $this;
  542. }
  543. /**
  544. * Whether this service is public facing.
  545. *
  546. * @return bool
  547. */
  548. public function isPublic()
  549. {
  550. return $this->public;
  551. }
  552. /**
  553. * Sets the synchronized flag of this service.
  554. *
  555. * @param bool $boolean
  556. *
  557. * @return Definition The current instance
  558. *
  559. * @deprecated since version 2.7, will be removed in 3.0.
  560. */
  561. public function setSynchronized($boolean, $triggerDeprecationError = true)
  562. {
  563. if ($triggerDeprecationError) {
  564. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.7 and will be removed in 3.0.', E_USER_DEPRECATED);
  565. }
  566. $this->synchronized = (bool) $boolean;
  567. return $this;
  568. }
  569. /**
  570. * Whether this service is synchronized.
  571. *
  572. * @return bool
  573. *
  574. * @deprecated since version 2.7, will be removed in 3.0.
  575. */
  576. public function isSynchronized($triggerDeprecationError = true)
  577. {
  578. if ($triggerDeprecationError) {
  579. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.7 and will be removed in 3.0.', E_USER_DEPRECATED);
  580. }
  581. return $this->synchronized;
  582. }
  583. /**
  584. * Sets the lazy flag of this service.
  585. *
  586. * @param bool $lazy
  587. *
  588. * @return Definition The current instance
  589. */
  590. public function setLazy($lazy)
  591. {
  592. $this->lazy = (bool) $lazy;
  593. return $this;
  594. }
  595. /**
  596. * Whether this service is lazy.
  597. *
  598. * @return bool
  599. */
  600. public function isLazy()
  601. {
  602. return $this->lazy;
  603. }
  604. /**
  605. * Sets whether this definition is synthetic, that is not constructed by the
  606. * container, but dynamically injected.
  607. *
  608. * @param bool $boolean
  609. *
  610. * @return Definition the current instance
  611. */
  612. public function setSynthetic($boolean)
  613. {
  614. $this->synthetic = (bool) $boolean;
  615. return $this;
  616. }
  617. /**
  618. * Whether this definition is synthetic, that is not constructed by the
  619. * container, but dynamically injected.
  620. *
  621. * @return bool
  622. */
  623. public function isSynthetic()
  624. {
  625. return $this->synthetic;
  626. }
  627. /**
  628. * Whether this definition is abstract, that means it merely serves as a
  629. * template for other definitions.
  630. *
  631. * @param bool $boolean
  632. *
  633. * @return Definition the current instance
  634. */
  635. public function setAbstract($boolean)
  636. {
  637. $this->abstract = (bool) $boolean;
  638. return $this;
  639. }
  640. /**
  641. * Whether this definition is abstract, that means it merely serves as a
  642. * template for other definitions.
  643. *
  644. * @return bool
  645. */
  646. public function isAbstract()
  647. {
  648. return $this->abstract;
  649. }
  650. /**
  651. * Whether this definition is deprecated, that means it should not be called
  652. * anymore.
  653. *
  654. * @param bool $status
  655. * @param string $template Template message to use if the definition is deprecated
  656. *
  657. * @return Definition the current instance
  658. *
  659. * @throws InvalidArgumentException When the message template is invalid.
  660. */
  661. public function setDeprecated($status = true, $template = null)
  662. {
  663. if (null !== $template) {
  664. if (preg_match('#[\r\n]|\*/#', $template)) {
  665. throw new InvalidArgumentException('Invalid characters found in deprecation template.');
  666. }
  667. if (false === strpos($template, '%service_id%')) {
  668. throw new InvalidArgumentException('The deprecation template must contain the "%service_id%" placeholder.');
  669. }
  670. $this->deprecationTemplate = $template;
  671. }
  672. $this->deprecated = (bool) $status;
  673. return $this;
  674. }
  675. /**
  676. * Whether this definition is deprecated, that means it should not be called
  677. * anymore.
  678. *
  679. * @return bool
  680. */
  681. public function isDeprecated()
  682. {
  683. return $this->deprecated;
  684. }
  685. /**
  686. * Message to use if this definition is deprecated.
  687. *
  688. * @param string $id Service id relying on this definition
  689. *
  690. * @return string
  691. */
  692. public function getDeprecationMessage($id)
  693. {
  694. return str_replace('%service_id%', $id, $this->deprecationTemplate);
  695. }
  696. /**
  697. * Sets a configurator to call after the service is fully initialized.
  698. *
  699. * @param callable $callable A PHP callable
  700. *
  701. * @return Definition The current instance
  702. */
  703. public function setConfigurator($callable)
  704. {
  705. $this->configurator = $callable;
  706. return $this;
  707. }
  708. /**
  709. * Gets the configurator to call after the service is fully initialized.
  710. *
  711. * @return callable|null The PHP callable to call
  712. */
  713. public function getConfigurator()
  714. {
  715. return $this->configurator;
  716. }
  717. /**
  718. * Sets types that will default to this definition.
  719. *
  720. * @param string[] $types
  721. *
  722. * @return Definition The current instance
  723. */
  724. public function setAutowiringTypes(array $types)
  725. {
  726. $this->autowiringTypes = array();
  727. foreach ($types as $type) {
  728. $this->autowiringTypes[$type] = true;
  729. }
  730. return $this;
  731. }
  732. /**
  733. * Is the definition autowired?
  734. *
  735. * @return bool
  736. */
  737. public function isAutowired()
  738. {
  739. return $this->autowired;
  740. }
  741. /**
  742. * Sets autowired.
  743. *
  744. * @param $autowired
  745. *
  746. * @return Definition The current instance
  747. */
  748. public function setAutowired($autowired)
  749. {
  750. $this->autowired = $autowired;
  751. return $this;
  752. }
  753. /**
  754. * Gets autowiring types that will default to this definition.
  755. *
  756. * @return string[]
  757. */
  758. public function getAutowiringTypes()
  759. {
  760. return array_keys($this->autowiringTypes);
  761. }
  762. /**
  763. * Adds a type that will default to this definition.
  764. *
  765. * @param string $type
  766. *
  767. * @return Definition The current instance
  768. */
  769. public function addAutowiringType($type)
  770. {
  771. $this->autowiringTypes[$type] = true;
  772. return $this;
  773. }
  774. /**
  775. * Removes a type.
  776. *
  777. * @param string $type
  778. *
  779. * @return Definition The current instance
  780. */
  781. public function removeAutowiringType($type)
  782. {
  783. unset($this->autowiringTypes[$type]);
  784. return $this;
  785. }
  786. /**
  787. * Will this definition default for the given type?
  788. *
  789. * @param string $type
  790. *
  791. * @return bool
  792. */
  793. public function hasAutowiringType($type)
  794. {
  795. return isset($this->autowiringTypes[$type]);
  796. }
  797. }