Code Duplication    Length = 12-12 lines in 2 locations

src/JsonEncoder.php 2 locations

@@ 311-322 (lines=12) @@
308
     *
309
     * @throws \InvalidArgumentException If the passed encoding is invalid.
310
     */
311
    public function setArrayEncoding($encoding)
312
    {
313
        if (self::JSON_ARRAY !== $encoding && self::JSON_OBJECT !== $encoding) {
314
            throw new \InvalidArgumentException(sprintf(
315
                'Expected JsonEncoder::JSON_ARRAY or JsonEncoder::JSON_OBJECT. '.
316
                'Got: %s',
317
                $encoding
318
            ));
319
        }
320
321
        $this->arrayEncoding = $encoding;
322
    }
323
324
    /**
325
     * Returns the encoding of numeric strings.
@@ 343-354 (lines=12) @@
340
     *
341
     * @throws \InvalidArgumentException If the passed encoding is invalid.
342
     */
343
    public function setNumericEncoding($encoding)
344
    {
345
        if (self::JSON_NUMBER !== $encoding && self::JSON_STRING !== $encoding) {
346
            throw new \InvalidArgumentException(sprintf(
347
                'Expected JsonEncoder::JSON_NUMBER or JsonEncoder::JSON_STRING. '.
348
                'Got: %s',
349
                $encoding
350
            ));
351
        }
352
353
        $this->numericEncoding = $encoding;
354
    }
355
356
    /**
357
     * Returns whether ampersands (&) are escaped.