ServiceConfigurator.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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\Loader\Configurator;
  11. use Symfony\Component\DependencyInjection\ContainerBuilder;
  12. use Symfony\Component\DependencyInjection\Definition;
  13. /**
  14. * @author Nicolas Grekas <p@tchwork.com>
  15. */
  16. class ServiceConfigurator extends AbstractServiceConfigurator
  17. {
  18. public const FACTORY = 'services';
  19. use Traits\AbstractTrait;
  20. use Traits\ArgumentTrait;
  21. use Traits\AutoconfigureTrait;
  22. use Traits\AutowireTrait;
  23. use Traits\BindTrait;
  24. use Traits\CallTrait;
  25. use Traits\ClassTrait;
  26. use Traits\ConfiguratorTrait;
  27. use Traits\DecorateTrait;
  28. use Traits\DeprecateTrait;
  29. use Traits\FactoryTrait;
  30. use Traits\FileTrait;
  31. use Traits\LazyTrait;
  32. use Traits\ParentTrait;
  33. use Traits\PropertyTrait;
  34. use Traits\PublicTrait;
  35. use Traits\ShareTrait;
  36. use Traits\SyntheticTrait;
  37. use Traits\TagTrait;
  38. private $container;
  39. private $instanceof;
  40. private $allowParent;
  41. private $path;
  42. public function __construct(ContainerBuilder $container, array $instanceof, bool $allowParent, ServicesConfigurator $parent, Definition $definition, $id, array $defaultTags, string $path = null)
  43. {
  44. $this->container = $container;
  45. $this->instanceof = $instanceof;
  46. $this->allowParent = $allowParent;
  47. $this->path = $path;
  48. parent::__construct($parent, $definition, $id, $defaultTags);
  49. }
  50. public function __destruct()
  51. {
  52. parent::__destruct();
  53. $this->container->removeBindings($this->id);
  54. $this->container->setDefinition($this->id, $this->definition->setInstanceofConditionals($this->instanceof));
  55. }
  56. }