public static function decode(string $json): self
    {
        if (!$document = self::fromString($json)) {
            throw new \InvalidArgumentException('Invalid JSON string.');
        }

        return $document;
    }
public static function decode(string $json): self
    {
        if (!$document = self::fromString($json)) {
            throw new \InvalidArgumentException('Invalid JSON string.');
        }

        return $document;
    }
public static function decode ( string $ json ) : self { if ( ! $ document = self :: fromString ( $ json ) ) { throw new \ InvalidArgumentException ( 'Invalid JSON string.' ) ; } return $ document ; }
Decode a JSON string into a document.

@param string $json
@return Document
Decode a JSON string into a document .