Total Complexity | 11 |
Total Lines | 30 |
Duplicated Lines | 0 % |
Changes | 3 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
7 | trait ResponseParseTrait |
||
8 | { |
||
9 | protected static function parseMeta($data) |
||
10 | { |
||
11 | if ((is_array($data) && Arr::has($data, 'meta'))) { |
||
12 | return Arr::get($data, 'meta'); |
||
13 | } else { |
||
14 | return []; |
||
15 | } |
||
16 | } |
||
17 | |||
18 | protected static function parseData($data) |
||
19 | { |
||
20 | if (is_array($data) && Arr::has($data, 'data')) { |
||
21 | return Arr::get($data, 'data'); |
||
22 | } else { |
||
23 | if (is_string($data) && json_decode($data)) { |
||
24 | return json_decode($data); |
||
25 | } else { |
||
26 | return $data; |
||
27 | } |
||
28 | } |
||
29 | } |
||
30 | |||
31 | protected static function parseDataMeta($data) |
||
37 | } |
||
38 | } |
||
39 | } |
||
40 |