Conditions | 7 |
Paths | 6 |
Total Lines | 24 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 7.7656 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php declare(strict_types = 1); |
||
42 | 1 | private static function prepareItemData($item) |
|
43 | { |
||
44 | 1 | if (method_exists($item, 'getArrayCopy')) { |
|
45 | 1 | return self::prepareUnserializableData($item->getArrayCopy()); |
|
46 | } |
||
47 | |||
48 | 1 | if (method_exists($item, 'toDateTime')) { |
|
49 | 1 | return 'ISODate("' . $item->toDateTime()->format('c') . '")'; |
|
50 | } |
||
51 | |||
52 | 1 | if (method_exists($item, '__toString')) { |
|
53 | return $item->__toString(); |
||
54 | } |
||
55 | |||
56 | 1 | if (method_exists($item, 'bsonSerialize')) { |
|
57 | return $item->bsonSerialize(); |
||
58 | } |
||
59 | |||
60 | 1 | if (is_array($item) || is_object($item)) { |
|
61 | return self::prepareUnserializableData((array)$item); |
||
62 | } |
||
63 | |||
64 | 1 | return $item; |
|
65 | } |
||
66 | |||
68 |