Conditions | 5 |
Paths | 10 |
Total Lines | 11 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 5 |
Changes | 0 |
1 | <?php |
||
40 | 8 | public function serialize($value) |
|
41 | { |
||
42 | 8 | $canCast = is_string($value) |
|
43 | 8 | || is_int($value) |
|
44 | 8 | || (is_object($value) && method_exists($value, '__toString')); |
|
45 | |||
46 | 8 | if (! $canCast) { |
|
47 | 5 | throw new Error('ID cannot represent value: ' . Utils::printSafe($value)); |
|
48 | } |
||
49 | |||
50 | 3 | return (string) $value; |
|
51 | } |
||
86 |