LightnCandy\Validator::delimiter PHP Method

delimiter() protected static method

Verify delimiters and operators
protected static delimiter ( string[] $token, array\arraystring | integer> &$context ) : boolean | null
$token string[] detected handlebars {{ }} token
$context array\arraystring | integer>
return boolean | null Return true when invalid
    protected static function delimiter($token, &$context)
    {
        // {{ }}} or {{{ }} are invalid
        if (strlen($token[Token::POS_BEGINRAW]) !== strlen($token[Token::POS_ENDRAW])) {
            $context['error'][] = 'Bad token ' . Token::toString($token) . ' ! Do you mean ' . Token::toString($token, array(Token::POS_BEGINRAW => '', Token::POS_ENDRAW => '')) . ' or ' . Token::toString($token, array(Token::POS_BEGINRAW => '{', Token::POS_ENDRAW => '}')) . '?';
            return true;
        }
        // {{{# }}} or {{{! }}} or {{{/ }}} or {{{^ }}} are invalid.
        if (strlen($token[Token::POS_BEGINRAW]) == 1 && $token[Token::POS_OP] && $token[Token::POS_OP] !== '&') {
            $context['error'][] = 'Bad token ' . Token::toString($token) . ' ! Do you mean ' . Token::toString($token, array(Token::POS_BEGINRAW => '', Token::POS_ENDRAW => '')) . ' ?';
            return true;
        }
    }