1 | <?php |
||
19 | class NumberValueNode extends Rule implements ValueInterface |
||
20 | { |
||
21 | /** |
||
22 | * @return string |
||
23 | */ |
||
24 | public function toString(): string |
||
28 | |||
29 | /** |
||
30 | * @return float|int |
||
31 | */ |
||
32 | public function toPrimitive() |
||
36 | |||
37 | /** |
||
38 | * @return int|float |
||
39 | */ |
||
40 | protected function parse() |
||
64 | |||
65 | /** |
||
66 | * @param LeafInterface $leaf |
||
67 | * @return bool |
||
68 | */ |
||
69 | private function isHex(LeafInterface $leaf): bool |
||
73 | |||
74 | /** |
||
75 | * @param string $value |
||
76 | * @return int |
||
77 | */ |
||
78 | private function parseHex(string $value): int |
||
82 | |||
83 | /** |
||
84 | * @param LeafInterface $leaf |
||
85 | * @return bool |
||
86 | */ |
||
87 | private function isBinary(LeafInterface $leaf): bool |
||
91 | |||
92 | /** |
||
93 | * @param string $value |
||
94 | * @return int |
||
95 | */ |
||
96 | private function parseBin(string $value): int |
||
100 | |||
101 | /** |
||
102 | * @param LeafInterface $leaf |
||
103 | * @return bool |
||
104 | */ |
||
105 | private function isExponential(LeafInterface $leaf): bool |
||
109 | |||
110 | /** |
||
111 | * @param string $value |
||
112 | * @return float |
||
113 | */ |
||
114 | private function parseExponential(string $value): float |
||
118 | |||
119 | /** |
||
120 | * @param LeafInterface $leaf |
||
121 | * @return bool |
||
122 | */ |
||
123 | private function isFloat(LeafInterface $leaf): bool |
||
127 | |||
128 | /** |
||
129 | * @param string $value |
||
130 | * @return float |
||
131 | */ |
||
132 | private function parseFloat(string $value): float |
||
136 | |||
137 | /** |
||
138 | * @param LeafInterface $leaf |
||
139 | * @return bool |
||
140 | */ |
||
141 | private function isInt(LeafInterface $leaf): bool |
||
145 | |||
146 | /** |
||
147 | * @param string $value |
||
148 | * @return int |
||
149 | */ |
||
150 | private function parseInt(string $value): int |
||
154 | } |
||
155 |