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.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

ContainerConfigurator.php

Zuletzt modifiziert: 02.04.2025, 15:03 - Dateigröße: 3.43 KiB


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\Argument\IteratorArgument;
015  use Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument;
016  use Symfony\Component\DependencyInjection\ContainerBuilder;
017  use Symfony\Component\DependencyInjection\Definition;
018  use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
019  use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
020  use Symfony\Component\ExpressionLanguage\Expression;
021   
022  /**
023   * @author Nicolas Grekas <p@tchwork.com>
024   */
025  class ContainerConfigurator extends AbstractConfigurator
026  {
027      const FACTORY = 'container';
028   
029      private $container;
030      private $loader;
031      private $instanceof;
032      private $path;
033      private $file;
034   
035      public function __construct(ContainerBuilder $container, PhpFileLoader $loader, array &$instanceof, $path, $file)
036      {
037          $this->container = $container;
038          $this->loader = $loader;
039          $this->instanceof = &$instanceof;
040          $this->path = $path;
041          $this->file = $file;
042      }
043   
044      final public function extension($namespace, array $config)
045      {
046          if (!$this->container->hasExtension($namespace)) {
047              $extensions = array_filter(array_map(function ($ext) { return $ext->getAlias(); }, $this->container->getExtensions()));
048              throw new InvalidArgumentException(sprintf('There is no extension able to load the configuration for "%s" (in "%s"). Looked for namespace "%s", found "%s".', $namespace, $this->file, $namespace, $extensions ? implode('", "', $extensions) : 'none'));
049          }
050   
051          $this->container->loadFromExtension($namespace, static::processValue($config));
052      }
053   
054      final public function import($resource, $type = null, $ignoreErrors = false)
055      {
056          $this->loader->setCurrentDir(\dirname($this->path));
057          $this->loader->import($resource, $type, $ignoreErrors, $this->file);
058      }
059   
060      /**
061       * @return ParametersConfigurator
062       */
063      final public function parameters()
064      {
065          return new ParametersConfigurator($this->container);
066      }
067   
068      /**
069       * @return ServicesConfigurator
070       */
071      final public function services()
072      {
073          return new ServicesConfigurator($this->container, $this->loader, $this->instanceof);
074      }
075  }
076   
077  /**
078   * Creates a service reference.
079   *
080   * @param string $id
081   *
082   * @return ReferenceConfigurator
083   */
084  function ref($id)
085  {
086      return new ReferenceConfigurator($id);
087  }
088   
089  /**
090   * Creates an inline service.
091   *
092   * @param string|null $class
093   *
094   * @return InlineServiceConfigurator
095   */
096  function inline($class = null)
097  {
098      return new InlineServiceConfigurator(new Definition($class));
099  }
100   
101  /**
102   * Creates a lazy iterator.
103   *
104   * @param ReferenceConfigurator[] $values
105   *
106   * @return IteratorArgument
107   */
108  function iterator(array $values)
109  {
110      return new IteratorArgument(AbstractConfigurator::processValue($values, true));
111  }
112   
113  /**
114   * Creates a lazy iterator by tag name.
115   *
116   * @param string $tag
117   *
118   * @return TaggedIteratorArgument
119   */
120  function tagged($tag)
121  {
122      return new TaggedIteratorArgument($tag);
123  }
124   
125  /**
126   * Creates an expression.
127   *
128   * @param string $expression an expression
129   *
130   * @return Expression
131   */
132  function expr($expression)
133  {
134      return new Expression($expression);
135  }
136