| Total Complexity | 7 |
| Total Lines | 34 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 5 | class ArrayUtil |
||
| 6 | { |
||
| 7 | public static function only(array $data, array $accept) |
||
| 10 | } |
||
| 11 | |||
| 12 | public static function except(array $data, array $except) |
||
| 13 | { |
||
| 14 | return self::check($data, $except, false); |
||
| 15 | } |
||
| 16 | |||
| 17 | private static function check($data, $keys, $in) |
||
| 18 | { |
||
| 19 | $array = []; |
||
| 20 | |||
| 21 | foreach ($data as $k => $v) { |
||
| 22 | if (in_array($k, $keys) === $in) { |
||
| 23 | $array[$k] = $v; |
||
| 24 | } |
||
| 25 | } |
||
| 26 | |||
| 27 | return $array; |
||
| 28 | } |
||
| 29 | |||
| 30 | public static function converToObject(array $data) |
||
| 39 | } |
||
| 40 | } |