Conditions | 4 |
Paths | 5 |
Total Lines | 27 |
Code Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
18 | public static function box(array $params) : Parameter |
||
19 | { |
||
20 | $fieldName = $params['fieldName']; |
||
21 | $filterAndOperator = $params['filterAndOperator']; |
||
22 | $op = $params['op']; |
||
23 | $operator = $params['operator']; |
||
24 | $salt = $params['salt']; |
||
25 | $value = $params['value']; |
||
26 | |||
27 | if (isset($operator['substitution_pattern'])) { |
||
28 | $isSingleValue = isset($filterAndOperator[1]) |
||
29 | && $op->isListOrNlist(); |
||
30 | |||
31 | if ($isSingleValue) { |
||
32 | $value = str_replace( |
||
33 | '{string}', |
||
34 | $value, |
||
35 | $operator['substitution_pattern'] |
||
36 | ); |
||
37 | } else { |
||
38 | $value = explode(',', $value); |
||
39 | } |
||
40 | } |
||
41 | |||
42 | return new self( |
||
43 | 'field_' . $fieldName . $salt, |
||
44 | $value |
||
45 | ); |
||
64 |