vendor/symfony/form/ChoiceList/Factory/Cache/ChoiceLoader.php line 27

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\Factory\Cache;
  11. use Symfony\Component\Form\ChoiceList\ChoiceListInterface;
  12. use Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface;
  13. use Symfony\Component\Form\FormTypeExtensionInterface;
  14. use Symfony\Component\Form\FormTypeInterface;
  15. /**
  16. * A cacheable wrapper for {@see FormTypeInterface} or {@see FormTypeExtensionInterface}
  17. * which configures a "choice_loader" option.
  18. *
  19. * @internal
  20. *
  21. * @author Jules Pietri <jules@heahprod.com>
  22. */
  23. final class ChoiceLoader extends AbstractStaticOption implements ChoiceLoaderInterface
  24. {
  25. /**
  26. * {@inheritdoc}
  27. */
  28. public function loadChoiceList(?callable $value = null): ChoiceListInterface
  29. {
  30. return $this->getOption()->loadChoiceList($value);
  31. }
  32. /**
  33. * {@inheritdoc}
  34. */
  35. public function loadChoicesForValues(array $values, ?callable $value = null): array
  36. {
  37. return $this->getOption()->loadChoicesForValues($values, $value);
  38. }
  39. /**
  40. * {@inheritdoc}
  41. */
  42. public function loadValuesForChoices(array $choices, ?callable $value = null): array
  43. {
  44. return $this->getOption()->loadValuesForChoices($choices, $value);
  45. }
  46. }