@@ 172-178 (lines=7) @@ | ||
169 | ->ifArray()->then(function($v) { |
|
170 | $options = 0; |
|
171 | foreach ($v as $option) { |
|
172 | if (is_numeric($option)) { |
|
173 | $options |= (int) $option; |
|
174 | } elseif (defined($option)) { |
|
175 | $options |= constant($option); |
|
176 | } else { |
|
177 | throw new InvalidArgumentException('Expected either an integer representing one of the JSON_ constants, or a string of the constant itself.'); |
|
178 | } |
|
179 | } |
|
180 | ||
181 | return $options; |
|
@@ 186-192 (lines=7) @@ | ||
183 | ->end() |
|
184 | ->beforeNormalization() |
|
185 | ->ifString()->then(function($v) { |
|
186 | if (is_numeric($v)) { |
|
187 | $value = (int) $v; |
|
188 | } elseif (defined($v)) { |
|
189 | $value = constant($v); |
|
190 | } else { |
|
191 | throw new InvalidArgumentException('Expected either an integer representing one of the JSON_ constants, or a string of the constant itself.'); |
|
192 | } |
|
193 | ||
194 | return $value; |
|
195 | }) |