| @@ 236-242 (lines=7) @@ | ||
| 233 | ->ifArray()->then(function($v) { |
|
| 234 | $options = 0; |
|
| 235 | foreach ($v as $option) { |
|
| 236 | if (is_numeric($option)) { |
|
| 237 | $options |= (int) $option; |
|
| 238 | } elseif (defined($option)) { |
|
| 239 | $options |= constant($option); |
|
| 240 | } else { |
|
| 241 | throw new InvalidArgumentException('Expected either an integer representing one of the JSON_ constants, or a string of the constant itself.'); |
|
| 242 | } |
|
| 243 | } |
|
| 244 | ||
| 245 | return $options; |
|
| @@ 250-256 (lines=7) @@ | ||
| 247 | ->end() |
|
| 248 | ->beforeNormalization() |
|
| 249 | ->ifString()->then(function($v) { |
|
| 250 | if (is_numeric($v)) { |
|
| 251 | $value = (int) $v; |
|
| 252 | } elseif (defined($v)) { |
|
| 253 | $value = constant($v); |
|
| 254 | } else { |
|
| 255 | throw new InvalidArgumentException('Expected either an integer representing one of the JSON_ constants, or a string of the constant itself.'); |
|
| 256 | } |
|
| 257 | ||
| 258 | return $value; |
|
| 259 | }) |
|