本文整理汇总了PHP中Doctrine\ORM\Query\Parser::FunctionDeclaration方法的典型用法代码示例。如果您正苦于以下问题:PHP Parser::FunctionDeclaration方法的具体用法?PHP Parser::FunctionDeclaration怎么用?PHP Parser::FunctionDeclaration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\ORM\Query\Parser
的用法示例。
在下文中一共展示了Parser::FunctionDeclaration方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parse
public function parse(\Doctrine\ORM\Query\Parser $parser)
{
$parser->match(Lexer::T_IDENTIFIER);
$parser->match(Lexer::T_OPEN_PARENTHESIS);
// Add the concat separator to the values array.
$this->values[] = $parser->ArithmeticExpression();
// Add the rest of the strings to the values array. CONCAT_WS must
// be used with at least 2 strings not including the separator.
$lexer = $parser->getLexer();
while (count($this->values) < 3 || $lexer->lookahead['type'] == Lexer::T_COMMA) {
$parser->match(Lexer::T_COMMA);
$peek = $lexer->glimpse();
$this->values[] = $peek['value'] == '(' ? $parser->FunctionDeclaration() : $parser->ArithmeticExpression();
}
while ($lexer->lookahead['type'] == Lexer::T_IDENTIFIER) {
switch (strtolower($lexer->lookahead['value'])) {
case 'notempty':
$parser->match(Lexer::T_IDENTIFIER);
$this->notEmpty = true;
break;
default:
// Identifier not recognized (causes exception).
$parser->match(Lexer::T_CLOSE_PARENTHESIS);
break;
}
}
$parser->match(Lexer::T_CLOSE_PARENTHESIS);
}
示例2: parse
/**
* Parse function
*
* @param \Doctrine\ORM\Query\Parser $parser Parser
*
* @return void
*/
public function parse(\Doctrine\ORM\Query\Parser $parser)
{
$parser->match(\Doctrine\ORM\Query\Lexer::T_IDENTIFIER);
$parser->match(\Doctrine\ORM\Query\Lexer::T_OPEN_PARENTHESIS);
try {
$this->ifThen = $parser->FunctionDeclaration();
} catch (\Doctrine\ORM\Query\QueryException $e) {
$this->ifThen = $parser->ScalarExpression();
}
$parser->match(\Doctrine\ORM\Query\Lexer::T_COMMA);
try {
$this->ifElse = $parser->FunctionDeclaration();
} catch (\Doctrine\ORM\Query\QueryException $e) {
$this->ifElse = $parser->ScalarExpression();
}
$parser->match(\Doctrine\ORM\Query\Lexer::T_CLOSE_PARENTHESIS);
}
示例3: parse
public function parse(Parser $parser)
{
$parser->match(Lexer::T_IDENTIFIER);
$parser->match(Lexer::T_OPEN_PARENTHESIS);
$this->values[] = $parser->ArithmeticExpression();
$lexer = $parser->getLexer();
while (count($this->values) < 3 || $lexer->lookahead['type'] == Lexer::T_COMMA) {
$parser->match(Lexer::T_COMMA);
$peek = $lexer->glimpse();
$this->values[] = $peek['value'] == '(' ? $parser->FunctionDeclaration() : $parser->ArithmeticExpression();
}
while ($lexer->lookahead['type'] == Lexer::T_IDENTIFIER) {
switch (strtolower($lexer->lookahead['value'])) {
case 'notempty':
$parser->match(Lexer::T_IDENTIFIER);
$this->notEmpty = true;
break;
default:
$parser->match(Lexer::T_CLOSE_PARENTHESIS);
break;
}
}
$parser->match(Lexer::T_CLOSE_PARENTHESIS);
}