src/JsonEncoder.php
public function setArrayEncoding($encoding)
    {
        if (self::JSON_ARRAY !== $encoding && self::JSON_OBJECT !== $encoding) {
            throw new \InvalidArgumentException(sprintf(
                'Expected JsonEncoder::JSON_ARRAY or JsonEncoder::JSON_OBJECT. '.
                'Got: %s',
                $encoding
            ));
        }

        $this->arrayEncoding = $encoding;
    }
public function setArrayEncoding($encoding)
    {
        if (self::JSON_ARRAY !== $encoding && self::JSON_OBJECT !== $encoding) {
            throw new \InvalidArgumentException(sprintf(
                'Expected JsonEncoder::JSON_ARRAY or JsonEncoder::JSON_OBJECT. '.
                'Got: %s',
                $encoding
            ));
        }

        $this->arrayEncoding = $encoding;
    }
public function setArrayEncoding ( $ encoding ) { if ( self :: JSON_ARRAY !== $ encoding && self :: JSON_OBJECT !== $ encoding ) { throw new \ InvalidArgumentException ( sprintf ( 'Expected JsonEncoder::JSON_ARRAY or JsonEncoder::JSON_OBJECT. ' . 'Got: %s' , $ encoding ) ) ; } $ this -> arrayEncoding = $ encoding ; }
Sets the encoding of non-associative arrays.

By default, non-associative arrays are decoded as JSON arrays.

@param int $encoding One of the constants {@link JSON_OBJECT} and {@link JSON_ARRAY}

@throws \InvalidArgumentException If the passed encoding is invalid
Sets the encoding of non - associative arrays .