Conditions | 5 |
Paths | 4 |
Total Lines | 14 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
36 | public function serialize($data) { |
||
37 | |||
38 | if($data instanceof IAPI) { |
||
39 | return [$this->level => [$data->toAPI()]]; |
||
40 | } |
||
41 | |||
42 | if(is_array($data) && array_key_exists($this->level, $data)) { |
||
43 | $data[$this->level] = $this->convert($data[$this->level]); |
||
44 | } elseif(is_array($data)) { |
||
45 | $data = [$this->level => $this->convert($data)]; |
||
46 | } |
||
47 | |||
48 | return $data; |
||
49 | } |
||
50 | |||
68 | } |