vendor/symfony/form/ChoiceList/View/ChoiceGroupView.php line 19

Open in your IDE?
  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\Form\ChoiceList\View;
  11. /**
  12.  * Represents a group of choices in templates.
  13.  *
  14.  * @author Bernhard Schussek <bschussek@gmail.com>
  15.  */
  16. class ChoiceGroupView implements \IteratorAggregate
  17. {
  18.     public $label;
  19.     public $choices;
  20.     /**
  21.      * Creates a new choice group view.
  22.      *
  23.      * @param string                         $label   The label of the group
  24.      * @param ChoiceGroupView[]|ChoiceView[] $choices the choice views in the group
  25.      */
  26.     public function __construct($label, array $choices = [])
  27.     {
  28.         $this->label $label;
  29.         $this->choices $choices;
  30.     }
  31.     /**
  32.      * {@inheritdoc}
  33.      *
  34.      * @return \Traversable<ChoiceGroupView|ChoiceView>
  35.      */
  36.     #[\ReturnTypeWillChange]
  37.     public function getIterator()
  38.     {
  39.         return new \ArrayIterator($this->choices);
  40.     }
  41. }