4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\DependencyInjection\Loader\Configurator;
14 use Symfony\Component\DependencyInjection\Definition;
15 use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
18 * @author Nicolas Grekas <p@tchwork.com>
20 class PrototypeConfigurator extends AbstractServiceConfigurator
22 const FACTORY = 'load';
24 use Traits\AbstractTrait;
25 use Traits\ArgumentTrait;
26 use Traits\AutoconfigureTrait;
27 use Traits\AutowireTrait;
30 use Traits\ConfiguratorTrait;
31 use Traits\DeprecateTrait;
32 use Traits\FactoryTrait;
34 use Traits\ParentTrait;
35 use Traits\PropertyTrait;
36 use Traits\PublicTrait;
37 use Traits\ShareTrait;
45 public function __construct(ServicesConfigurator $parent, PhpFileLoader $loader, Definition $defaults, $namespace, $resource, $allowParent)
47 $definition = new Definition();
48 $definition->setPublic($defaults->isPublic());
49 $definition->setAutowired($defaults->isAutowired());
50 $definition->setAutoconfigured($defaults->isAutoconfigured());
51 $definition->setBindings($defaults->getBindings());
52 $definition->setChanges(array());
54 $this->loader = $loader;
55 $this->resource = $resource;
56 $this->allowParent = $allowParent;
58 parent::__construct($parent, $definition, $namespace, $defaults->getTags());
61 public function __destruct()
66 $this->loader->registerClasses($this->definition, $this->id, $this->resource, $this->exclude);
72 * Excludes files from registration using a glob pattern.
74 * @param string $exclude
78 final public function exclude($exclude)
80 $this->exclude = $exclude;