@@ 2093-2109 (lines=17) @@ | ||
2090 | * |
|
2091 | * @return \Doctrine\ORM\Query\AST\GeneralCaseExpression |
|
2092 | */ |
|
2093 | public function GeneralCaseExpression() |
|
2094 | { |
|
2095 | $this->match(Lexer::T_CASE); |
|
2096 | ||
2097 | // Process WhenClause (1..N) |
|
2098 | $whenClauses = []; |
|
2099 | ||
2100 | do { |
|
2101 | $whenClauses[] = $this->WhenClause(); |
|
2102 | } while ($this->lexer->isNextToken(Lexer::T_WHEN)); |
|
2103 | ||
2104 | $this->match(Lexer::T_ELSE); |
|
2105 | $scalarExpression = $this->ScalarExpression(); |
|
2106 | $this->match(Lexer::T_END); |
|
2107 | ||
2108 | return new AST\GeneralCaseExpression($whenClauses, $scalarExpression); |
|
2109 | } |
|
2110 | ||
2111 | /** |
|
2112 | * SimpleCaseExpression ::= "CASE" CaseOperand SimpleWhenClause {SimpleWhenClause}* "ELSE" ScalarExpression "END" |
|
@@ 2117-2134 (lines=18) @@ | ||
2114 | * |
|
2115 | * @return AST\SimpleCaseExpression |
|
2116 | */ |
|
2117 | public function SimpleCaseExpression() |
|
2118 | { |
|
2119 | $this->match(Lexer::T_CASE); |
|
2120 | $caseOperand = $this->StateFieldPathExpression(); |
|
2121 | ||
2122 | // Process SimpleWhenClause (1..N) |
|
2123 | $simpleWhenClauses = []; |
|
2124 | ||
2125 | do { |
|
2126 | $simpleWhenClauses[] = $this->SimpleWhenClause(); |
|
2127 | } while ($this->lexer->isNextToken(Lexer::T_WHEN)); |
|
2128 | ||
2129 | $this->match(Lexer::T_ELSE); |
|
2130 | $scalarExpression = $this->ScalarExpression(); |
|
2131 | $this->match(Lexer::T_END); |
|
2132 | ||
2133 | return new AST\SimpleCaseExpression($caseOperand, $simpleWhenClauses, $scalarExpression); |
|
2134 | } |
|
2135 | ||
2136 | /** |
|
2137 | * WhenClause ::= "WHEN" ConditionalExpression "THEN" ScalarExpression |