[ Index ]

PHP Cross Reference of phpBB-3.3.14-deutsch

title

Body

[close]

/vendor/symfony/dependency-injection/Loader/Configurator/ -> DefaultsConfigurator.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\Exception\InvalidArgumentException;
  15  
  16  /**
  17   * @author Nicolas Grekas <p@tchwork.com>
  18   *
  19   * @method InstanceofConfigurator instanceof(string $fqcn)
  20   */
  21  class DefaultsConfigurator extends AbstractServiceConfigurator
  22  {
  23      const FACTORY = 'defaults';
  24  
  25      use Traits\AutoconfigureTrait;
  26      use Traits\AutowireTrait;
  27      use Traits\BindTrait;
  28      use Traits\PublicTrait;
  29  
  30      /**
  31       * Adds a tag for this definition.
  32       *
  33       * @param string $name       The tag name
  34       * @param array  $attributes An array of attributes
  35       *
  36       * @return $this
  37       *
  38       * @throws InvalidArgumentException when an invalid tag name or attribute is provided
  39       */
  40      final public function tag($name, array $attributes = [])
  41      {
  42          if (!\is_string($name) || '' === $name) {
  43              throw new InvalidArgumentException('The tag name in "_defaults" must be a non-empty string.');
  44          }
  45  
  46          foreach ($attributes as $attribute => $value) {
  47              if (!is_scalar($value) && null !== $value) {
  48                  throw new InvalidArgumentException(sprintf('Tag "%s", attribute "%s" in "_defaults" must be of a scalar-type.', $name, $attribute));
  49              }
  50          }
  51  
  52          $this->definition->addTag($name, $attributes);
  53  
  54          return $this;
  55      }
  56  
  57      /**
  58       * Defines an instanceof-conditional to be applied to following service definitions.
  59       *
  60       * @param string $fqcn
  61       *
  62       * @return InstanceofConfigurator
  63       */
  64      final protected function setInstanceof($fqcn)
  65      {
  66          return $this->parent->instanceof($fqcn);
  67      }
  68  }


Generated: Mon Nov 25 19:05:08 2024 Cross-referenced by PHPXref 0.7.1