| Conditions | 9 | 
| Paths | 7 | 
| Total Lines | 34 | 
| Code Lines | 23 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Tests | 0 | 
| CRAP Score | 90 | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
| 1 | <?php | ||
| 19 | public function serialize($method, array $params = []) | ||
| 20 |     { | ||
| 21 | $toBeVisited = [&$params]; | ||
| 22 | |||
| 23 |         while (isset($toBeVisited[0]) && $value = &$toBeVisited[0]) { | ||
| 24 | $type = gettype($value); | ||
| 25 | |||
| 26 |             if ($type === 'array') { | ||
| 27 |                 foreach ($value as &$child) { | ||
| 28 | $toBeVisited[] = &$child; | ||
| 29 | } | ||
| 30 |             } elseif ($type === 'object') { | ||
| 31 |                 if ($value instanceof \DateTime) { | ||
| 32 |                     $value = $value->format('Ymd\TH:i:s'); | ||
| 33 | xmlrpc_set_type($value, 'datetime'); | ||
| 34 |                 } elseif ($value instanceof Base64) { | ||
| 35 | $value = $value->getDecoded(); | ||
| 36 | xmlrpc_set_type($value, 'base64'); | ||
| 37 |                 } else { | ||
| 38 | $value = get_object_vars($value); | ||
| 39 | } | ||
| 40 |             } elseif ($type === 'resource') { | ||
| 41 | throw new InvalidTypeException($value); | ||
| 42 | } | ||
| 43 | |||
| 44 | array_shift($toBeVisited); | ||
| 45 | } | ||
| 46 | |||
| 47 | return xmlrpc_encode_request( | ||
| 48 | $method, | ||
| 49 | $params, | ||
| 50 | ['encoding' => 'UTF-8', 'escaping' => 'markup', 'verbosity' => 'no_white_space'] | ||
| 51 | ); | ||
| 52 | } | ||
| 53 | } | ||
| 54 |