@@ 218-224 (lines=7) @@ | ||
215 | ->ifArray()->then(function($v) { |
|
216 | $options = 0; |
|
217 | foreach ($v as $option) { |
|
218 | if (is_numeric($option)) { |
|
219 | $options |= (int) $option; |
|
220 | } elseif (defined($option)) { |
|
221 | $options |= constant($option); |
|
222 | } else { |
|
223 | throw new InvalidArgumentException('Expected either an integer representing one of the JSON_ constants, or a string of the constant itself.'); |
|
224 | } |
|
225 | } |
|
226 | ||
227 | return $options; |
|
@@ 232-238 (lines=7) @@ | ||
229 | ->end() |
|
230 | ->beforeNormalization() |
|
231 | ->ifString()->then(function($v) { |
|
232 | if (is_numeric($v)) { |
|
233 | $value = (int) $v; |
|
234 | } elseif (defined($v)) { |
|
235 | $value = constant($v); |
|
236 | } else { |
|
237 | throw new InvalidArgumentException('Expected either an integer representing one of the JSON_ constants, or a string of the constant itself.'); |
|
238 | } |
|
239 | ||
240 | return $value; |
|
241 | }) |