| Conditions | 5 |
| Paths | 5 |
| Total Lines | 24 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 11 | protected function doSerialize($var, Handlers $handlers) |
||
| 12 | { |
||
| 13 | if(is_object($var)) { |
||
| 14 | $class = get_class($var); |
||
| 15 | $handler = $handlers->getHandler($class); |
||
| 16 | |||
| 17 | if(null === $handler) { |
||
| 18 | throw new \RuntimeException(sprintf('No serialization handler for class %s!', $class)); |
||
| 19 | } |
||
| 20 | |||
| 21 | return $this->doSerialize(call_user_func_array($handler, array($var)), $handlers); |
||
| 22 | } |
||
| 23 | |||
| 24 | if(is_array($var)) { |
||
| 25 | $return = array(); |
||
| 26 | foreach($var as $key => $value) { |
||
| 27 | $return[$key] = $this->doSerialize($value, $handlers); |
||
| 28 | } |
||
| 29 | |||
| 30 | return $return; |
||
| 31 | } |
||
| 32 | |||
| 33 | return $var; |
||
| 34 | } |
||
| 35 | } |
||
| 36 |