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