Total Complexity | 5 |
Total Lines | 42 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 0 |
1 | <?php |
||
12 | class ExpressionLanguage extends AbstractRule |
||
13 | { |
||
14 | /** |
||
15 | * @inheritdoc |
||
16 | */ |
||
17 | public function apply($rowData, &$transformedData, $options = []) |
||
18 | { |
||
19 | $values = [ |
||
20 | 'rowData' => $rowData, |
||
21 | 'transformedData' => $transformedData, |
||
22 | ]; |
||
23 | |||
24 | if (isset($options['values'])) { |
||
25 | $newOptions = $options; |
||
26 | unset($newOptions['values']); |
||
27 | foreach ($options['values'] as $valueKey => $value) { |
||
28 | $values[$valueKey] = $this->ruleApplier->apply($rowData, $transformedData, $value, $newOptions); |
||
29 | } |
||
30 | } else { |
||
31 | } |
||
32 | |||
33 | $expressionLanguage = new \Symfony\Component\ExpressionLanguage\ExpressionLanguage(); |
||
34 | return $expressionLanguage->evaluate($options['expression'], $values); |
||
35 | } |
||
36 | |||
37 | /** |
||
38 | * Get unique code that needs to be used to apply this rule. |
||
39 | * |
||
40 | * @return string |
||
41 | */ |
||
42 | public function getRuleCode() |
||
43 | { |
||
44 | return 'expression_language'; |
||
45 | } |
||
46 | |||
47 | |||
48 | /** |
||
49 | * @inheritdoc |
||
50 | */ |
||
51 | public function validate($options) |
||
54 | } |
||
55 | } |