Code Duplication    Length = 12-12 lines in 2 locations

src/JsonEncoder.php 2 locations

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