vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Definition.php line 881

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