[ Index ]

PHP Cross Reference of phpBB-3.3.14-deutsch

title

Body

[close]

/vendor/symfony/dependency-injection/Argument/ -> IteratorArgument.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\Argument;
  13  
  14  use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
  15  use Symfony\Component\DependencyInjection\Reference;
  16  
  17  /**
  18   * Represents a collection of values to lazily iterate over.
  19   *
  20   * @author Titouan Galopin <galopintitouan@gmail.com>
  21   */
  22  class IteratorArgument implements ArgumentInterface
  23  {
  24      private $values;
  25  
  26      /**
  27       * @param Reference[] $values
  28       */
  29      public function __construct(array $values)
  30      {
  31          $this->setValues($values);
  32      }
  33  
  34      /**
  35       * @return array The values to lazily iterate over
  36       */
  37      public function getValues()
  38      {
  39          return $this->values;
  40      }
  41  
  42      /**
  43       * @param Reference[] $values The service references to lazily iterate over
  44       */
  45      public function setValues(array $values)
  46      {
  47          foreach ($values as $k => $v) {
  48              if (null !== $v && !$v instanceof Reference) {
  49                  throw new InvalidArgumentException(sprintf('An IteratorArgument must hold only Reference instances, "%s" given.', \is_object($v) ? \get_class($v) : \gettype($v)));
  50              }
  51          }
  52  
  53          $this->values = $values;
  54      }
  55  }


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