| Total Complexity | 12 |
| Total Lines | 66 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 1 | Features | 1 |
| 1 | <?php |
||
| 8 | class DataUtils |
||
| 9 | { |
||
| 10 | public function removeKeysByPrefix(array $data, $prefix) |
||
| 11 | { |
||
| 12 | return array_intersect_key( |
||
| 13 | $data, |
||
| 14 | array_flip( |
||
| 15 | array_filter( |
||
| 16 | array_keys($data), |
||
| 17 | function ($key) use ($prefix) { |
||
| 18 | return strpos($key, $prefix) !== 0; |
||
| 19 | } |
||
| 20 | ) |
||
| 21 | ) |
||
| 22 | ); |
||
| 23 | } |
||
| 24 | |||
| 25 | public function walkArrayNodes(array $list, \Closure $callback) |
||
| 26 | { |
||
| 27 | $list = $callback($list); |
||
| 28 | |||
| 29 | foreach ($list as $key => $value) { |
||
| 30 | if (!is_array($value)) { |
||
| 31 | continue; |
||
| 32 | } |
||
| 33 | |||
| 34 | $list[$key] = $this->walkArrayNodes($value, $callback); |
||
| 35 | } |
||
| 36 | |||
| 37 | return $list; |
||
| 38 | } |
||
| 39 | |||
| 40 | public function renderConstant(array $data, array $keys, $constant, $default = '') |
||
| 47 | } |
||
| 48 | |||
| 49 | public function renderValue(array $data, $key, $format, $default = '') |
||
| 56 | } |
||
| 57 | |||
| 58 | public function extractValue(array $data, $key, $default = '') |
||
| 59 | { |
||
| 60 | if (!isset($data[$key])) { |
||
| 61 | return $default; |
||
| 62 | } |
||
| 63 | |||
| 64 | return $data[$key]; |
||
| 65 | } |
||
| 66 | |||
| 67 | public function assureArrayValue($value) |
||
| 74 | } |
||
| 75 | } |
||
| 76 |