| Total Complexity | 4 |
| Total Lines | 39 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 8 | class FieldConfiguration extends Configuration |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * @var array |
||
| 12 | */ |
||
| 13 | private $allowedFields; |
||
| 14 | |||
| 15 | public function __construct(array $allowedFields = []) |
||
| 20 | } |
||
| 21 | |||
| 22 | public function configureOptions(OptionsResolver $resolver): void |
||
| 23 | { |
||
| 24 | $resolver |
||
| 25 | ->setDefaults([ |
||
| 26 | 'type' => null, |
||
| 27 | 'options' => [], |
||
| 28 | ]) |
||
| 29 | // Set allowed fields type from tagged services |
||
| 30 | ->setAllowedValues('type', array_merge([null], $this->allowedFields)) |
||
| 31 | ->setAllowedTypes('type', [ |
||
| 32 | 'string', |
||
| 33 | 'null', |
||
| 34 | ]) |
||
| 35 | ->setAllowedTypes('options', 'array') |
||
| 36 | ; |
||
| 37 | } |
||
| 38 | |||
| 39 | public function getType(): ?string |
||
| 40 | { |
||
| 41 | return $this->get('type'); |
||
| 42 | } |
||
| 43 | |||
| 44 | public function getOptions(): array |
||
| 47 | } |
||
| 48 | } |
||
| 49 |