Conditions | 5 |
Paths | 7 |
Total Lines | 25 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 30 |
Changes | 0 |
1 | <?php |
||
26 | protected function normalizeData(array $data, Scope $scope) |
||
27 | { |
||
28 | $includedData = []; |
||
29 | |||
30 | // Bail now |
||
31 | if (null === $data) { |
||
32 | return $includedData; |
||
33 | } |
||
34 | |||
35 | if (is_string($data)) { |
||
36 | $data = [$data]; |
||
37 | } |
||
38 | |||
39 | foreach ($data as $key => $val) { |
||
40 | if (!$scope->includeValue($this, $key)) { |
||
41 | continue; |
||
42 | } |
||
43 | $includedData[$key] = $scope->parseValue($val, $data, $key); |
||
44 | } |
||
45 | |||
46 | // Return only the requested fields |
||
47 | $includedData = $scope->filterFields($includedData); |
||
48 | |||
49 | return $includedData; |
||
50 | } |
||
51 | } |
||
52 |