private function assertValidPath(string $mimetype, string $parameters, string $data): void
    {
        if (1 !== preg_match(self::REGEXP_MIMETYPE, $mimetype)) {
            throw new SyntaxError(sprintf('The path mimetype `%s` is invalid', $mimetype));
        }

        $is_binary = 1 === preg_match(self::REGEXP_BINARY, $parameters, $matches);
        if ($is_binary) {
            $parameters = substr($parameters, 0, - strlen($matches[0]));
        }

        $res = array_filter(array_filter(explode(';', $parameters), [$this, 'validateParameter']));
        if ([] !== $res) {
            throw new SyntaxError(sprintf('The path paremeters `%s` is invalid', $parameters));
        }

        if (!$is_binary) {
            return;
        }

        $res = base64_decode($data, true);
        if (false === $res || $data !== base64_encode($res)) {
            throw new SyntaxError(sprintf('The path data `%s` is invalid', $data));
        }
    }
private function assertValidPath(string $mimetype, string $parameters, string $data): void
    {
        if (1 !== preg_match(self::REGEXP_MIMETYPE, $mimetype)) {
            throw new SyntaxError(sprintf('The path mimetype `%s` is invalid', $mimetype));
        }

        $is_binary = 1 === preg_match(self::REGEXP_BINARY, $parameters, $matches);
        if ($is_binary) {
            $parameters = substr($parameters, 0, - strlen($matches[0]));
        }

        $res = array_filter(array_filter(explode(';', $parameters), [$this, 'validateParameter']));
        if ([] !== $res) {
            throw new SyntaxError(sprintf('The path paremeters `%s` is invalid', $parameters));
        }

        if (!$is_binary) {
            return;
        }

        $res = base64_decode($data, true);
        if (false === $res || $data !== base64_encode($res)) {
            throw new SyntaxError(sprintf('The path data `%s` is invalid', $data));
        }
    }
private function assertValidPath ( string $ mimetype , string $ parameters , string $ data ) : void { if ( 1 !== preg_match ( self :: REGEXP_MIMETYPE , $ mimetype ) ) { throw new SyntaxError ( sprintf ( 'The path mimetype `%s` is invalid' , $ mimetype ) ) ; } $ is_binary = 1 === preg_match ( self :: REGEXP_BINARY , $ parameters , $ matches ) ; if ( $ is_binary ) { $ parameters = substr ( $ parameters , 0 , - strlen ( $ matches [ 0 ] ) ) ; } $ res = array_filter ( array_filter ( explode ( ';' , $ parameters ) , [ $ this , 'validateParameter' ] ) ) ; if ( [ ] !== $ res ) { throw new SyntaxError ( sprintf ( 'The path paremeters `%s` is invalid' , $ parameters ) ) ; } if ( ! $ is_binary ) { return ; } $ res = base64_decode ( $ data , true ) ; if ( false === $ res || $ data !== base64_encode ( $ res ) ) { throw new SyntaxError ( sprintf ( 'The path data `%s` is invalid' , $ data ) ) ; } }
Assert the path is a compliant with RFC2397.

@see https://tools.ietf.org/html/rfc2397

@throws SyntaxError If the mediatype or the data are not compliant with the RFC2397
Assert the path is a compliant with RFC2397 .