public function decode(string $json, int $options = null)
    {
        if ($options !== null) {
            return (clone $this)->decode($json);
        }

        $shouldBeArray = $this->hasOption(\JSON_OBJECT_AS_ARRAY);

        return $this->wrap(function () use ($json, $shouldBeArray) {
            return @\json_decode($json, $shouldBeArray, $this->getRecursionDepth(), $this->getOptions());
        });
    }
public function decode(string $json, int $options = null)
    {
        if ($options !== null) {
            return (clone $this)->decode($json);
        }

        $shouldBeArray = $this->hasOption(\JSON_OBJECT_AS_ARRAY);

        return $this->wrap(function () use ($json, $shouldBeArray) {
            return @\json_decode($json, $shouldBeArray, $this->getRecursionDepth(), $this->getOptions());
        });
    }
public function decode ( string $ json , int $ options = null ) { if ( $ options !== null ) { return ( clone $ this ) -> decode ( $ json ) ; } $ shouldBeArray = $ this -> hasOption ( \ JSON_OBJECT_AS_ARRAY ) ; return $ this -> wrap ( function ( ) use ( $ json , $ shouldBeArray ) { return @ \ json_decode ( $ json , $ shouldBeArray , $ this -> getRecursionDepth ( ) , $ this -> getOptions ( ) ) ; } ) ; }
Wrapper for json_decode with predefined options that throws
a Railt\Component\Json\Exception\JsonException when an error occurs.

@see http://www.php.net/manual/en/function.json-decode.php
@see http://php.net/manual/en/class.jsonexception.php
@param string $json
@param int|null $options
@return mixed
@throws JsonException
Wrapper for json_decode with predefined options that throws a Railt \ Component \ Json \ Exception \ JsonException when an error occurs .