| 1 | <?php |
||
| 11 | * @author Yann Eugoné <[email protected]> |
||
| 12 | */ |
||
| 13 | class EnumExtension extends Twig_Extension |
||
| 14 | { |
||
| 15 | /** |
||
| 16 | * @var EnumRegistryInterface |
||
| 17 | */ |
||
| 18 | private $registry; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * @param EnumRegistryInterface $registry |
||
| 22 | */ |
||
| 23 | public function __construct(EnumRegistryInterface $registry) |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @inheritdoc |
||
| 30 | */ |
||
| 31 | public function getFunctions() |
||
| 38 | |||
| 39 | /** |
||
| 40 | * @inheritdoc |
||
| 41 | */ |
||
| 42 | public function getFilters() |
||
| 48 | |||
| 49 | /** |
||
| 50 | * @param string $value |
||
| 51 | * @param string $enum |
||
| 52 | * |
||
| 53 | * @return string |
||
| 54 | */ |
||
| 55 | public function getLabel($value, $enum) |
||
| 65 | |||
| 66 | /** |
||
| 67 | * @param string $enum |
||
| 68 | * |
||
| 69 | * @return array |
||
| 70 | */ |
||
| 71 | public function getChoices($enum) |
||
| 75 | |||
| 76 | /** |
||
| 77 | * @inheritdoc |
||
| 78 | */ |
||
| 79 | public function getName() |
||
| 80 | { |
||
| 81 | return 'enum'; |
||
| 82 | } |
||
| 84 |