| Total Complexity | 6 |
| Total Lines | 35 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 18 | class ExpressionStrategy extends AbstractConstraintStrategy |
||
| 19 | { |
||
| 20 | public function generateArguments(array $config): array |
||
| 21 | { |
||
| 22 | $parent = parent::generateArguments($config); |
||
| 23 | |||
| 24 | $parent['expression'] = $config['expression']; |
||
| 25 | |||
| 26 | $this->provideValues($parent, $config); |
||
| 27 | |||
| 28 | return $parent; |
||
| 29 | } |
||
| 30 | |||
| 31 | protected function provideValues(array &$args, array &$config): void |
||
| 32 | { |
||
| 33 | if (empty($config['variable'])) { |
||
| 34 | return; |
||
| 35 | } |
||
| 36 | |||
| 37 | $values = []; |
||
| 38 | foreach ($config['variable'] as $value) { |
||
| 39 | $values[$value['name']] = $this->sanitize($value['value']); |
||
| 40 | } |
||
| 41 | |||
| 42 | $args['values'] = $values; |
||
| 43 | } |
||
| 44 | |||
| 45 | protected function getValidatorProperty(): string |
||
| 46 | { |
||
| 47 | return 'expression'; |
||
| 48 | } |
||
| 49 | |||
| 50 | protected function getAttributeClassName(): string |
||
| 53 | } |
||
| 54 | } |
||
| 55 |