@@ 330-341 (lines=12) @@ | ||
327 | * |
|
328 | * @throws \InvalidArgumentException If the passed encoding is invalid |
|
329 | */ |
|
330 | public function setArrayEncoding($encoding) |
|
331 | { |
|
332 | if (self::JSON_ARRAY !== $encoding && self::JSON_OBJECT !== $encoding) { |
|
333 | throw new \InvalidArgumentException(sprintf( |
|
334 | 'Expected JsonEncoder::JSON_ARRAY or JsonEncoder::JSON_OBJECT. '. |
|
335 | 'Got: %s', |
|
336 | $encoding |
|
337 | )); |
|
338 | } |
|
339 | ||
340 | $this->arrayEncoding = $encoding; |
|
341 | } |
|
342 | ||
343 | /** |
|
344 | * Returns the encoding of numeric strings. |
|
@@ 362-373 (lines=12) @@ | ||
359 | * |
|
360 | * @throws \InvalidArgumentException If the passed encoding is invalid |
|
361 | */ |
|
362 | public function setNumericEncoding($encoding) |
|
363 | { |
|
364 | if (self::JSON_NUMBER !== $encoding && self::JSON_STRING !== $encoding) { |
|
365 | throw new \InvalidArgumentException(sprintf( |
|
366 | 'Expected JsonEncoder::JSON_NUMBER or JsonEncoder::JSON_STRING. '. |
|
367 | 'Got: %s', |
|
368 | $encoding |
|
369 | )); |
|
370 | } |
|
371 | ||
372 | $this->numericEncoding = $encoding; |
|
373 | } |
|
374 | ||
375 | /** |
|
376 | * Returns whether ampersands (&) are escaped. |