src/UriTemplate/UriTemplate.php
public static function getErrors($template, array $options = array()) {
    $errors = array();
    foreach (self::getExpressions($template, $options) as $expression) {
        if (!$expression['valid']) {
            $errors[] = 'Malformed expression: "'.$expression['complete'].'" at offset '.$expression['offset'];
            continue;
        }
        try {
            $expression = self::parseExpression($expression['expression']);
            foreach ($expression['varspecs'] as $varspec) {
                try {
                    $varspec = self::parseVarspec($varspec);
                } catch (UriTemplateException $e) {
                    $errors[] = $e->getMessage();
                }
            }
        } catch (UriTemplateException $e) {
            $errors[] = $e->getMessage();
        }
    }
    return $errors;
}
public static function getErrors($template, array $options = array()) {
    $errors = array();
    foreach (self::getExpressions($template, $options) as $expression) {
        if (!$expression['valid']) {
            $errors[] = 'Malformed expression: "'.$expression['complete'].'" at offset '.$expression['offset'];
            continue;
        }
        try {
            $expression = self::parseExpression($expression['expression']);
            foreach ($expression['varspecs'] as $varspec) {
                try {
                    $varspec = self::parseVarspec($varspec);
                } catch (UriTemplateException $e) {
                    $errors[] = $e->getMessage();
                }
            }
        } catch (UriTemplateException $e) {
            $errors[] = $e->getMessage();
        }
    }
    return $errors;
}
public static function getErrors ( $ template , array $ options = array ( ) ) { $ errors = array ( ) ; foreach ( self :: getExpressions ( $ template , $ options ) as $ expression ) { if ( ! $ expression [ 'valid' ] ) { $ errors [ ] = 'Malformed expression: "' . $ expression [ 'complete' ] . '" at offset ' . $ expression [ 'offset' ] ; continue ; } try { $ expression = self :: parseExpression ( $ expression [ 'expression' ] ) ; foreach ( $ expression [ 'varspecs' ] as $ varspec ) { try { $ varspec = self :: parseVarspec ( $ varspec ) ; } catch ( UriTemplateException $ e ) { $ errors [ ] = $ e -> getMessage ( ) ; } } } catch ( UriTemplateException $ e ) { $ errors [ ] = $ e -> getMessage ( ) ; } } return $ errors ; }
Get a list of errors in a URI Template.

Some errors can only be detected when processing the template.
E.g. using the prefix modifier on an array value ("{var:2}" where var is an array)

@param  string $template  URI template
@param  array  $options   Optional settings - open, close
open - string to mark the beginning of a substitution expression
close - string to mark the end of a substitution expression
@return array             List of parser errors (an empty array means there were no errors)
Get a list of errors in a URI Template .