| Conditions | 6 |
| Paths | 6 |
| Total Lines | 16 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 53 | 54 | public static function translateObjects($input) |
|
| 54 | { |
||
| 55 | 54 | if (is_object($input)) { |
|
| 56 | 29 | if (method_exists($input, 'getData')) { |
|
| 57 | 29 | return $input->getData(); |
|
| 58 | 3 | } elseif ($data = $input->data) { |
|
| 59 | 3 | return static::translateObjects($data); |
|
| 60 | } |
||
| 61 | 3 | return $input; |
|
| 62 | 54 | } elseif (is_array($input)) { |
|
| 63 | 54 | foreach ($input as &$item) { |
|
| 64 | 54 | $item = static::translateObjects($item); |
|
| 65 | } |
||
| 66 | 54 | return $input; |
|
| 67 | } else { |
||
| 68 | 54 | return $input; |
|
| 69 | } |
||
| 72 |