| Conditions | 8 |
| Paths | 6 |
| Total Lines | 29 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | public function jsonSerialize() |
||
| 15 | { |
||
| 16 | $ret = array(); |
||
| 17 | foreach($this as $key => $value) |
||
| 18 | { |
||
| 19 | if($key === 'server' || $key === 'count') |
||
| 20 | { |
||
| 21 | continue; |
||
| 22 | } |
||
| 23 | if(is_numeric($key)) |
||
| 24 | { |
||
| 25 | continue; |
||
| 26 | } |
||
| 27 | if($key === 'jpegphoto') |
||
| 28 | { |
||
| 29 | $ret[$key] = base64_encode($value[0]); |
||
| 30 | continue; |
||
| 31 | } |
||
| 32 | if(is_array($value) && $value['count'] === 1) |
||
| 33 | { |
||
| 34 | $ret[$key] = $value[0]; |
||
| 35 | } |
||
| 36 | else |
||
| 37 | { |
||
| 38 | $ret[$key] = $value; |
||
| 39 | } |
||
| 40 | } |
||
| 41 | return $ret; |
||
| 42 | } |
||
| 43 | } |
||
| 45 |
Adding explicit visibility (
private,protected, orpublic) is generally recommend to communicate to other developers how, and from where this method is intended to be used.