| Total Complexity | 20 |
| Total Lines | 59 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | class Normalize |
||
| 11 | { |
||
| 12 | public static function normalize(mixed $value): mixed |
||
| 13 | { |
||
| 14 | if (null === $value || is_bool($value) || is_int($value) || is_float($value) || is_string($value)) { |
||
| 15 | return $value; |
||
| 16 | } |
||
| 17 | |||
| 18 | if ($value instanceof DateTimeInterface) { |
||
| 19 | return $value->format(DateTimeInterface::ATOM); |
||
| 20 | } |
||
| 21 | |||
| 22 | if (is_array($value)) { |
||
| 23 | return self::normalizeArray($value); |
||
| 24 | } |
||
| 25 | |||
| 26 | if (is_object($value)) { |
||
| 27 | return self::normalizeObject($value); |
||
| 28 | } |
||
| 29 | |||
| 30 | return null; |
||
| 31 | } |
||
| 32 | |||
| 33 | private static function normalizeArray(array $array): mixed |
||
| 42 | } |
||
| 43 | |||
| 44 | private static function normalizeObject(object $object): mixed |
||
| 72 |