Verzeichnisstruktur phpBB-3.3.15
- Veröffentlicht
- 28.08.2024
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
AbstractServiceConfigurator.php
001 <?php
002
003 /*
004 * This file is part of the Symfony package.
005 *
006 * (c) Fabien Potencier <fabien@symfony.com>
007 *
008 * For the full copyright and license information, please view the LICENSE
009 * file that was distributed with this source code.
010 */
011
012 namespace Symfony\Component\DependencyInjection\Loader\Configurator;
013
014 use Symfony\Component\DependencyInjection\Definition;
015 use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
016
017 abstract class AbstractServiceConfigurator extends AbstractConfigurator
018 {
019 protected $parent;
020 protected $id;
021 private $defaultTags = [];
022
023 public function __construct(ServicesConfigurator $parent, Definition $definition, $id = null, array $defaultTags = [])
024 {
025 $this->parent = $parent;
026 $this->definition = $definition;
027 $this->id = $id;
028 $this->defaultTags = $defaultTags;
029 }
030
031 public function __destruct()
032 {
033 // default tags should be added last
034 foreach ($this->defaultTags as $name => $attributes) {
035 foreach ($attributes as $attributes) {
036 $this->definition->addTag($name, $attributes);
037 }
038 }
039 $this->defaultTags = [];
040 }
041
042 /**
043 * Registers a service.
044 *
045 * @param string $id
046 * @param string|null $class
047 *
048 * @return ServiceConfigurator
049 */
050 final public function set($id, $class = null)
051 {
052 $this->__destruct();
053
054 return $this->parent->set($id, $class);
055 }
056
057 /**
058 * Creates an alias.
059 *
060 * @param string $id
061 * @param string $referencedId
062 *
063 * @return AliasConfigurator
064 */
065 final public function alias($id, $referencedId)
066 {
067 $this->__destruct();
068
069 return $this->parent->alias($id, $referencedId);
070 }
071
072 /**
073 * Registers a PSR-4 namespace using a glob pattern.
074 *
075 * @param string $namespace
076 * @param string $resource
077 *
078 * @return PrototypeConfigurator
079 */
080 final public function load($namespace, $resource)
081 {
082 $this->__destruct();
083
084 return $this->parent->load($namespace, $resource);
085 }
086
087 /**
088 * Gets an already defined service definition.
089 *
090 * @param string $id
091 *
092 * @return ServiceConfigurator
093 *
094 * @throws ServiceNotFoundException if the service definition does not exist
095 */
096 final public function get($id)
097 {
098 $this->__destruct();
099
100 return $this->parent->get($id);
101 }
102
103 /**
104 * Registers a service.
105 *
106 * @param string $id
107 * @param string|null $class
108 *
109 * @return ServiceConfigurator
110 */
111 final public function __invoke($id, $class = null)
112 {
113 $this->__destruct();
114
115 return $this->parent->set($id, $class);
116 }
117 }
118