| Total Complexity | 5 |
| Total Lines | 33 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 16 | class Get extends AbstractRule |
||
| 17 | { |
||
| 18 | /** |
||
| 19 | 2 | * @inheritdoc |
|
| 20 | */ |
||
| 21 | 2 | public function apply(array $rowData, array &$transformedData, array $options = []) |
|
| 22 | 2 | { |
|
| 23 | if (!is_array($options['field'])) { |
||
| 24 | $options['field'] = [$options['field']]; |
||
| 25 | 2 | } |
|
| 26 | 2 | ||
| 27 | 2 | $fields = []; |
|
| 28 | foreach ($options['field'] as $field) { |
||
| 29 | $fields[] = AssociativeArray::getFromKey($rowData, '@column.' . $field, $field, '.'); |
||
| 30 | 2 | } |
|
| 31 | |||
| 32 | return AssociativeArray::getFromKey($rowData, $fields); |
||
| 33 | } |
||
| 34 | |||
| 35 | /** |
||
| 36 | 2 | * @inheritdoc |
|
| 37 | */ |
||
| 38 | 2 | public function validate(array $options): void |
|
| 39 | 2 | { |
|
| 40 | $this->requireOption('field', $options); |
||
| 41 | } |
||
| 42 | |||
| 43 | /** |
||
| 44 | 1 | * @inheritdoc |
|
| 45 | */ |
||
| 46 | 1 | public function getRuleCode(): string |
|
| 49 | } |
||
| 50 | } |
||
| 51 |