[ Index ]

PHP Cross Reference of phpBB-3.3.2-deutsch

title

Body

[close]

/vendor/symfony/dependency-injection/Loader/Configurator/ -> PrototypeConfigurator.php (source)

   1  <?php
   2  
   3  /*
   4   * This file is part of the Symfony package.
   5   *
   6   * (c) Fabien Potencier <fabien@symfony.com>
   7   *
   8   * For the full copyright and license information, please view the LICENSE
   9   * file that was distributed with this source code.
  10   */
  11  
  12  namespace Symfony\Component\DependencyInjection\Loader\Configurator;
  13  
  14  use Symfony\Component\DependencyInjection\Definition;
  15  use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
  16  
  17  /**
  18   * @author Nicolas Grekas <p@tchwork.com>
  19   */
  20  class PrototypeConfigurator extends AbstractServiceConfigurator
  21  {
  22      const FACTORY = 'load';
  23  
  24      use Traits\AbstractTrait;
  25      use Traits\ArgumentTrait;
  26      use Traits\AutoconfigureTrait;
  27      use Traits\AutowireTrait;
  28      use Traits\BindTrait;
  29      use Traits\CallTrait;
  30      use Traits\ConfiguratorTrait;
  31      use Traits\DeprecateTrait;
  32      use Traits\FactoryTrait;
  33      use Traits\LazyTrait;
  34      use Traits\ParentTrait;
  35      use Traits\PropertyTrait;
  36      use Traits\PublicTrait;
  37      use Traits\ShareTrait;
  38      use Traits\TagTrait;
  39  
  40      private $loader;
  41      private $resource;
  42      private $exclude;
  43      private $allowParent;
  44  
  45      public function __construct(ServicesConfigurator $parent, PhpFileLoader $loader, Definition $defaults, $namespace, $resource, $allowParent)
  46      {
  47          $definition = new Definition();
  48          if (!$defaults->isPublic() || !$defaults->isPrivate()) {
  49              $definition->setPublic($defaults->isPublic());
  50          }
  51          $definition->setAutowired($defaults->isAutowired());
  52          $definition->setAutoconfigured($defaults->isAutoconfigured());
  53          // deep clone, to avoid multiple process of the same instance in the passes
  54          $definition->setBindings(unserialize(serialize($defaults->getBindings())));
  55          $definition->setChanges([]);
  56  
  57          $this->loader = $loader;
  58          $this->resource = $resource;
  59          $this->allowParent = $allowParent;
  60  
  61          parent::__construct($parent, $definition, $namespace, $defaults->getTags());
  62      }
  63  
  64      public function __destruct()
  65      {
  66          parent::__destruct();
  67  
  68          if ($this->loader) {
  69              $this->loader->registerClasses($this->definition, $this->id, $this->resource, $this->exclude);
  70          }
  71          $this->loader = null;
  72      }
  73  
  74      /**
  75       * Excludes files from registration using a glob pattern.
  76       *
  77       * @param string $exclude
  78       *
  79       * @return $this
  80       */
  81      final public function exclude($exclude)
  82      {
  83          $this->exclude = $exclude;
  84  
  85          return $this;
  86      }
  87  }


Generated: Wed Nov 11 20:28:18 2020 Cross-referenced by PHPXref 0.7.1