1 | <?php |
||
25 | final class Normalizer |
||
26 | { |
||
27 | /** |
||
28 | * Normalizes a value: Converts nulls, booleans, integers, |
||
29 | * floats, strings and arrays into their respective nodes |
||
30 | * |
||
31 | * @param mixed $value The value to normalize |
||
32 | * |
||
33 | * @return Expr The normalized value |
||
34 | */ |
||
35 | public function __invoke($value): Expr |
||
51 | |||
52 | /** |
||
53 | * Return array or object node |
||
54 | * |
||
55 | * @param array<mixed>|mixed|object $value |
||
56 | * |
||
57 | * @return Scalar\String_|Scalar\LNumber|Scalar\DNumber|Expr\Array_|Expr\FuncCall |
||
58 | */ |
||
59 | private function getValueNode($value): Expr |
||
75 | |||
76 | /** |
||
77 | * Return array or object node |
||
78 | * |
||
79 | * @param array<mixed>|mixed|object $value |
||
80 | * |
||
81 | * @return Expr\Array_|Expr\FuncCall |
||
82 | */ |
||
83 | private function getValueNodeNoScalar($value): Expr |
||
95 | |||
96 | /** |
||
97 | * Return "unserialize($object)" node |
||
98 | * |
||
99 | * @param object $object |
||
100 | */ |
||
101 | private function normalizeObject($object): Expr\FuncCall |
||
111 | |||
112 | /** |
||
113 | * Return array value node |
||
114 | * |
||
115 | * @param array<int, mixed> $value |
||
116 | */ |
||
117 | private function arrayValue($value): Expr\Array_ |
||
138 | } |
||
139 |