src/Translate.php
protected function addResourceString(string $resource): void
    {
        $data = json_decode($resource, true);
        if (json_last_error() !== \JSON_ERROR_NONE) {
            if (function_exists('json_last_error_msg')) {
                throw new \InvalidArgumentException(json_last_error_msg(), json_last_error());
            }
            throw new \InvalidArgumentException("Error parsing JSON.", json_last_error());
        }

        $this->addResourceArray($data);
    }
protected function addResourceString(string $resource): void
    {
        $data = json_decode($resource, true);
        if (json_last_error() !== \JSON_ERROR_NONE) {
            if (function_exists('json_last_error_msg')) {
                throw new \InvalidArgumentException(json_last_error_msg(), json_last_error());
            }
            throw new \InvalidArgumentException("Error parsing JSON.", json_last_error());
        }

        $this->addResourceArray($data);
    }
protected function addResourceString ( string $ resource ) : void { $ data = json_decode ( $ resource , true ) ; if ( json_last_error ( ) !== \ JSON_ERROR_NONE ) { if ( function_exists ( 'json_last_error_msg' ) ) { throw new \ InvalidArgumentException ( json_last_error_msg ( ) , json_last_error ( ) ) ; } throw new \ InvalidArgumentException ( "Error parsing JSON." , json_last_error ( ) ) ; } $ this -> addResourceArray ( $ data ) ; }
Adds a resource represented in a JSON string
@param string $resource The resource as JSON data
@throws \InvalidArgumentException If the resource is not valid JSON
Adds a resource represented in a JSON string