@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | * |
| 126 | 126 | * @param string $dateTime datetime to get the year from |
| 127 | 127 | * |
| 128 | - * @return int |
|
| 128 | + * @return string |
|
| 129 | 129 | */ |
| 130 | 130 | public static function year($dateTime) |
| 131 | 131 | { |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | * |
| 139 | 139 | * @param string $dateTime datetime to get the month from |
| 140 | 140 | * |
| 141 | - * @return int |
|
| 141 | + * @return string |
|
| 142 | 142 | */ |
| 143 | 143 | public static function month($dateTime) |
| 144 | 144 | { |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | * |
| 152 | 152 | * @param string $dateTime datetime to get the day from |
| 153 | 153 | * |
| 154 | - * @return int |
|
| 154 | + * @return string |
|
| 155 | 155 | */ |
| 156 | 156 | public static function day($dateTime) |
| 157 | 157 | { |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | * |
| 165 | 165 | * @param string $dateTime datetime to get the hour from |
| 166 | 166 | * |
| 167 | - * @return int |
|
| 167 | + * @return string |
|
| 168 | 168 | */ |
| 169 | 169 | public static function hour($dateTime) |
| 170 | 170 | { |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | * |
| 178 | 178 | * @param string $dateTime datetime to get the minute from |
| 179 | 179 | * |
| 180 | - * @return int |
|
| 180 | + * @return string |
|
| 181 | 181 | */ |
| 182 | 182 | public static function minute($dateTime) |
| 183 | 183 | { |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | * |
| 191 | 191 | * @param string $dateTime datetime to get the second from |
| 192 | 192 | * |
| 193 | - * @return int |
|
| 193 | + * @return string |
|
| 194 | 194 | */ |
| 195 | 195 | public static function second($dateTime) |
| 196 | 196 | { |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | return false; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - $outValue = "'" . $value . "'"; |
|
| 63 | + $outValue = "'".$value."'"; |
|
| 64 | 64 | return true; |
| 65 | 65 | } |
| 66 | 66 | |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | public function convertToOData($value) |
| 101 | 101 | { |
| 102 | - return 'datetime\'' . urlencode($value) . '\''; |
|
| 102 | + return 'datetime\''.urlencode($value).'\''; |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |
@@ -5,7 +5,6 @@ |
||
| 5 | 5 | use POData\Common\ODataException; |
| 6 | 6 | use POData\Common\Messages; |
| 7 | 7 | use POData\Providers\Metadata\ResourceTypeKind; |
| 8 | -use POData\Configuration\ServiceConfiguration; |
|
| 9 | 8 | use POData\Providers\Metadata\ResourceType; |
| 10 | 9 | use POData\Providers\Metadata\ResourceSetWrapper; |
| 11 | 10 | use POData\Providers\ProvidersWrapper; |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | $expandSubPathSegment |
| 196 | 196 | ); |
| 197 | 197 | if (is_null($resourceProperty)) { |
| 198 | - throw ODataException::createSyntaxError( |
|
| 198 | + throw ODataException::createSyntaxError( |
|
| 199 | 199 | Messages::expandProjectionParserPropertyNotFound( |
| 200 | 200 | $resourceType->getFullName(), |
| 201 | 201 | $expandSubPathSegment, |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | ) |
| 204 | 204 | ); |
| 205 | 205 | } else if ($resourceProperty->getTypeKind() != ResourceTypeKind::ENTITY) { |
| 206 | - throw ODataException::createBadRequestError( |
|
| 206 | + throw ODataException::createBadRequestError( |
|
| 207 | 207 | Messages::expandProjectionParserExpandCanOnlyAppliedToEntity( |
| 208 | 208 | $resourceType->getFullName(), |
| 209 | 209 | $expandSubPathSegment |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | $resourceProperty |
| 219 | 219 | ); |
| 220 | 220 | if (is_null($resourceSetWrapper)) { |
| 221 | - throw ODataException::createBadRequestError( |
|
| 221 | + throw ODataException::createBadRequestError( |
|
| 222 | 222 | Messages::badRequestInvalidPropertyNameSpecified( |
| 223 | 223 | $resourceType->getFullName(), |
| 224 | 224 | $expandSubPathSegment |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | if (!($currentNode instanceof RootProjectionNode) |
| 296 | 296 | && !($currentNode instanceof ExpandedProjectionNode) |
| 297 | 297 | ) { |
| 298 | - throw ODataException::createBadRequestError( |
|
| 298 | + throw ODataException::createBadRequestError( |
|
| 299 | 299 | Messages::expandProjectionParserPropertyWithoutMatchingExpand( |
| 300 | 300 | $currentNode->getPropertyName() |
| 301 | 301 | ) |
@@ -326,21 +326,21 @@ discard block |
||
| 326 | 326 | |
| 327 | 327 | if (!$isLastSegment) { |
| 328 | 328 | if ($resourceProperty->isKindOf(ResourcePropertyKind::BAG)) { |
| 329 | - throw ODataException::createBadRequestError( |
|
| 329 | + throw ODataException::createBadRequestError( |
|
| 330 | 330 | Messages::expandProjectionParserBagPropertyAsInnerSelectSegment( |
| 331 | 331 | $currentResourceType->getFullName(), |
| 332 | 332 | $selectSubPathSegment |
| 333 | 333 | ) |
| 334 | 334 | ); |
| 335 | 335 | } else if ($resourceProperty->isKindOf(ResourcePropertyKind::PRIMITIVE)) { |
| 336 | - throw ODataException::createBadRequestError( |
|
| 336 | + throw ODataException::createBadRequestError( |
|
| 337 | 337 | Messages::expandProjectionParserPrimitivePropertyUsedAsNavigationProperty( |
| 338 | 338 | $currentResourceType->getFullName(), |
| 339 | 339 | $selectSubPathSegment |
| 340 | 340 | ) |
| 341 | 341 | ); |
| 342 | 342 | } else if ($resourceProperty->isKindOf(ResourcePropertyKind::COMPLEX_TYPE)) { |
| 343 | - throw ODataException::createBadRequestError( |
|
| 343 | + throw ODataException::createBadRequestError( |
|
| 344 | 344 | Messages::expandProjectionParserComplexPropertyAsInnerSelectSegment( |
| 345 | 345 | $currentResourceType->getFullName(), |
| 346 | 346 | $selectSubPathSegment |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | $node = $currentNode->findNode($selectSubPathSegment); |
| 357 | 357 | if (is_null($node)) { |
| 358 | 358 | if (!$isLastSegment) { |
| 359 | - throw ODataException::createBadRequestError( |
|
| 359 | + throw ODataException::createBadRequestError( |
|
| 360 | 360 | Messages::expandProjectionParserPropertyWithoutMatchingExpand( |
| 361 | 361 | $selectSubPathSegment |
| 362 | 362 | ) |
@@ -241,7 +241,7 @@ |
||
| 241 | 241 | //assert(!empty($keys)) |
| 242 | 242 | $orderBy = null; |
| 243 | 243 | foreach ($keys as $key) { |
| 244 | - $orderBy = $orderBy . $key . ', '; |
|
| 244 | + $orderBy = $orderBy.$key.', '; |
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | $orderBy = rtrim($orderBy, ', '); |
@@ -117,7 +117,7 @@ |
||
| 117 | 117 | /** |
| 118 | 118 | * To get the text being parsed |
| 119 | 119 | * |
| 120 | - * @return string |
|
| 120 | + * @return char[] |
|
| 121 | 121 | */ |
| 122 | 122 | public function getExpressionText() |
| 123 | 123 | { |
@@ -166,111 +166,111 @@ |
||
| 166 | 166 | $t = null; |
| 167 | 167 | $tokenPos = $this->_textPos; |
| 168 | 168 | switch ($this->_ch) { |
| 169 | - case '(': |
|
| 170 | - $this->_nextChar(); |
|
| 171 | - $t = ExpressionTokenId::OPENPARAM; |
|
| 172 | - break; |
|
| 173 | - case ')': |
|
| 174 | - $this->_nextChar(); |
|
| 175 | - $t = ExpressionTokenId::CLOSEPARAM; |
|
| 176 | - break; |
|
| 177 | - case ',': |
|
| 178 | - $this->_nextChar(); |
|
| 179 | - $t = ExpressionTokenId::COMMA; |
|
| 180 | - break; |
|
| 181 | - case '-': |
|
| 182 | - $hasNext = $this->_textPos + 1 < $this->_textLen; |
|
| 183 | - if ($hasNext && Char::isDigit($this->_text[$this->_textPos + 1])) { |
|
| 184 | - $this->_nextChar(); |
|
| 185 | - $t = $this->_parseFromDigit(); |
|
| 186 | - if (self::isNumeric($t)) { |
|
| 187 | - break; |
|
| 188 | - } |
|
| 189 | - |
|
| 190 | - $this->_setTextPos($tokenPos); |
|
| 191 | - } else if ($hasNext && $this->_text[$tokenPos + 1] == 'I') { |
|
| 192 | - $this->_nextChar(); |
|
| 193 | - $this->_parseIdentifier(); |
|
| 194 | - $currentIdentifier = substr($this->_text, $tokenPos + 1, $this->_textPos - $tokenPos - 1); |
|
| 195 | - |
|
| 196 | - if (self::_isInfinityLiteralDouble($currentIdentifier)) { |
|
| 197 | - $t = ExpressionTokenId::DOUBLE_LITERAL; |
|
| 198 | - break; |
|
| 199 | - } else if (self::_isInfinityLiteralSingle($currentIdentifier)) { |
|
| 200 | - $t = ExpressionTokenId::SINGLE_LITERAL; |
|
| 201 | - break; |
|
| 202 | - } |
|
| 203 | - |
|
| 204 | - // If it looked like '-INF' but wasn't we'll rewind and fall |
|
| 205 | - // through to a simple '-' token. |
|
| 206 | - $this->_setTextPos($tokenPos); |
|
| 207 | - } |
|
| 208 | - |
|
| 209 | - $this->_nextChar(); |
|
| 210 | - $t = ExpressionTokenId::MINUS; |
|
| 211 | - break; |
|
| 212 | - case '=': |
|
| 213 | - $this->_nextChar(); |
|
| 214 | - $t = ExpressionTokenId::EQUAL; |
|
| 215 | - break; |
|
| 216 | - case '/': |
|
| 217 | - $this->_nextChar(); |
|
| 218 | - $t = ExpressionTokenId::SLASH; |
|
| 219 | - break; |
|
| 220 | - case '?': |
|
| 221 | - $this->_nextChar(); |
|
| 222 | - $t = ExpressionTokenId::QUESTION; |
|
| 223 | - break; |
|
| 224 | - case '.': |
|
| 225 | - $this->_nextChar(); |
|
| 226 | - $t = ExpressionTokenId::DOT; |
|
| 227 | - break; |
|
| 228 | - case '\'': |
|
| 229 | - $quote = $this->_ch; |
|
| 230 | - do { |
|
| 231 | - $this->_nextChar(); |
|
| 232 | - while ($this->_textPos < $this->_textLen && $this->_ch != $quote) { |
|
| 233 | - $this->_nextChar(); |
|
| 234 | - } |
|
| 235 | - |
|
| 236 | - if ($this->_textPos == $this->_textLen) { |
|
| 237 | - $this->_parseError( |
|
| 238 | - Messages::expressionLexerUnterminatedStringLiteral( |
|
| 239 | - $this->_textPos, $this->_text |
|
| 240 | - ) |
|
| 241 | - ); |
|
| 242 | - } |
|
| 243 | - |
|
| 244 | - $this->_nextChar(); |
|
| 245 | - } while ($this->_ch == $quote); |
|
| 246 | - $t = ExpressionTokenId::STRING_LITERAL; |
|
| 247 | - break; |
|
| 248 | - case '*': |
|
| 249 | - $this->_nextChar(); |
|
| 250 | - $t = ExpressionTokenId::STAR; |
|
| 251 | - break; |
|
| 252 | - default: |
|
| 253 | - if (Char::isLetter($this->_ch) || $this->_ch == '_') { |
|
| 254 | - $this->_parseIdentifier(); |
|
| 255 | - $t = ExpressionTokenId::IDENTIFIER; |
|
| 256 | - break; |
|
| 257 | - } |
|
| 258 | - |
|
| 259 | - if (Char::isDigit($this->_ch)) { |
|
| 260 | - $t = $this->_parseFromDigit(); |
|
| 261 | - break; |
|
| 262 | - } |
|
| 263 | - |
|
| 264 | - if ($this->_textPos == $this->_textLen) { |
|
| 265 | - $t = ExpressionTokenId::END; |
|
| 266 | - break; |
|
| 267 | - } |
|
| 268 | - |
|
| 269 | - $this->_parseError( |
|
| 270 | - Messages::expressionLexerInvalidCharacter( |
|
| 271 | - $this->_ch, $this->_textPos |
|
| 272 | - ) |
|
| 273 | - ); |
|
| 169 | + case '(': |
|
| 170 | + $this->_nextChar(); |
|
| 171 | + $t = ExpressionTokenId::OPENPARAM; |
|
| 172 | + break; |
|
| 173 | + case ')': |
|
| 174 | + $this->_nextChar(); |
|
| 175 | + $t = ExpressionTokenId::CLOSEPARAM; |
|
| 176 | + break; |
|
| 177 | + case ',': |
|
| 178 | + $this->_nextChar(); |
|
| 179 | + $t = ExpressionTokenId::COMMA; |
|
| 180 | + break; |
|
| 181 | + case '-': |
|
| 182 | + $hasNext = $this->_textPos + 1 < $this->_textLen; |
|
| 183 | + if ($hasNext && Char::isDigit($this->_text[$this->_textPos + 1])) { |
|
| 184 | + $this->_nextChar(); |
|
| 185 | + $t = $this->_parseFromDigit(); |
|
| 186 | + if (self::isNumeric($t)) { |
|
| 187 | + break; |
|
| 188 | + } |
|
| 189 | + |
|
| 190 | + $this->_setTextPos($tokenPos); |
|
| 191 | + } else if ($hasNext && $this->_text[$tokenPos + 1] == 'I') { |
|
| 192 | + $this->_nextChar(); |
|
| 193 | + $this->_parseIdentifier(); |
|
| 194 | + $currentIdentifier = substr($this->_text, $tokenPos + 1, $this->_textPos - $tokenPos - 1); |
|
| 195 | + |
|
| 196 | + if (self::_isInfinityLiteralDouble($currentIdentifier)) { |
|
| 197 | + $t = ExpressionTokenId::DOUBLE_LITERAL; |
|
| 198 | + break; |
|
| 199 | + } else if (self::_isInfinityLiteralSingle($currentIdentifier)) { |
|
| 200 | + $t = ExpressionTokenId::SINGLE_LITERAL; |
|
| 201 | + break; |
|
| 202 | + } |
|
| 203 | + |
|
| 204 | + // If it looked like '-INF' but wasn't we'll rewind and fall |
|
| 205 | + // through to a simple '-' token. |
|
| 206 | + $this->_setTextPos($tokenPos); |
|
| 207 | + } |
|
| 208 | + |
|
| 209 | + $this->_nextChar(); |
|
| 210 | + $t = ExpressionTokenId::MINUS; |
|
| 211 | + break; |
|
| 212 | + case '=': |
|
| 213 | + $this->_nextChar(); |
|
| 214 | + $t = ExpressionTokenId::EQUAL; |
|
| 215 | + break; |
|
| 216 | + case '/': |
|
| 217 | + $this->_nextChar(); |
|
| 218 | + $t = ExpressionTokenId::SLASH; |
|
| 219 | + break; |
|
| 220 | + case '?': |
|
| 221 | + $this->_nextChar(); |
|
| 222 | + $t = ExpressionTokenId::QUESTION; |
|
| 223 | + break; |
|
| 224 | + case '.': |
|
| 225 | + $this->_nextChar(); |
|
| 226 | + $t = ExpressionTokenId::DOT; |
|
| 227 | + break; |
|
| 228 | + case '\'': |
|
| 229 | + $quote = $this->_ch; |
|
| 230 | + do { |
|
| 231 | + $this->_nextChar(); |
|
| 232 | + while ($this->_textPos < $this->_textLen && $this->_ch != $quote) { |
|
| 233 | + $this->_nextChar(); |
|
| 234 | + } |
|
| 235 | + |
|
| 236 | + if ($this->_textPos == $this->_textLen) { |
|
| 237 | + $this->_parseError( |
|
| 238 | + Messages::expressionLexerUnterminatedStringLiteral( |
|
| 239 | + $this->_textPos, $this->_text |
|
| 240 | + ) |
|
| 241 | + ); |
|
| 242 | + } |
|
| 243 | + |
|
| 244 | + $this->_nextChar(); |
|
| 245 | + } while ($this->_ch == $quote); |
|
| 246 | + $t = ExpressionTokenId::STRING_LITERAL; |
|
| 247 | + break; |
|
| 248 | + case '*': |
|
| 249 | + $this->_nextChar(); |
|
| 250 | + $t = ExpressionTokenId::STAR; |
|
| 251 | + break; |
|
| 252 | + default: |
|
| 253 | + if (Char::isLetter($this->_ch) || $this->_ch == '_') { |
|
| 254 | + $this->_parseIdentifier(); |
|
| 255 | + $t = ExpressionTokenId::IDENTIFIER; |
|
| 256 | + break; |
|
| 257 | + } |
|
| 258 | + |
|
| 259 | + if (Char::isDigit($this->_ch)) { |
|
| 260 | + $t = $this->_parseFromDigit(); |
|
| 261 | + break; |
|
| 262 | + } |
|
| 263 | + |
|
| 264 | + if ($this->_textPos == $this->_textLen) { |
|
| 265 | + $t = ExpressionTokenId::END; |
|
| 266 | + break; |
|
| 267 | + } |
|
| 268 | + |
|
| 269 | + $this->_parseError( |
|
| 270 | + Messages::expressionLexerInvalidCharacter( |
|
| 271 | + $this->_ch, $this->_textPos |
|
| 272 | + ) |
|
| 273 | + ); |
|
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | $this->_token->Id = $t; |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | while ($this->_token->Id == ExpressionTokenId::DOT) { |
| 352 | 352 | $this->nextToken(); |
| 353 | 353 | $this->validateToken(ExpressionTokenId::IDENTIFIER); |
| 354 | - $identifier = $identifier . '.' . $this->_token->Text; |
|
| 354 | + $identifier = $identifier.'.'.$this->_token->Text; |
|
| 355 | 355 | $this->nextToken(); |
| 356 | 356 | } |
| 357 | 357 | |
@@ -458,7 +458,7 @@ discard block |
||
| 458 | 458 | || strcasecmp('X', $tokenText) == 0 |
| 459 | 459 | || strcasecmp('x', $tokenText) == 0 |
| 460 | 460 | ) { |
| 461 | - $id = ExpressionTokenId::BINARY_LITERAL; |
|
| 461 | + $id = ExpressionTokenId::BINARY_LITERAL; |
|
| 462 | 462 | } else { |
| 463 | 463 | return; |
| 464 | 464 | } |
@@ -16,11 +16,8 @@ |
||
| 16 | 16 | use POData\Providers\Metadata\Type\Guid; |
| 17 | 17 | use POData\Providers\Metadata\Type\Binary; |
| 18 | 18 | use POData\Providers\Metadata\Type\Null1; |
| 19 | -use POData\Providers\Metadata\Type\INavigationType; |
|
| 20 | -use POData\Providers\Metadata\Type\TypeCode; |
|
| 21 | 19 | use POData\Providers\Metadata\Type\IType; |
| 22 | 20 | use POData\Providers\Metadata\ResourceType; |
| 23 | -use POData\Providers\Metadata\ResourceSet; |
|
| 24 | 21 | use POData\Providers\Metadata\ResourcePropertyKind; |
| 25 | 22 | use POData\UriProcessor\QueryProcessor\ExpressionParser\Expressions\AbstractExpression; |
| 26 | 23 | use POData\UriProcessor\QueryProcessor\ExpressionParser\Expressions\PropertyAccessExpression; |
@@ -690,81 +690,81 @@ |
||
| 690 | 690 | |
| 691 | 691 | $null = new Null1(); |
| 692 | 692 | if ($left->typeIs($null) || $right->typeIs($null)) { |
| 693 | - // If the end user is responsible for implementing IExpressionProvider |
|
| 694 | - // then the sub-tree for a nullability check would be: |
|
| 695 | - // |
|
| 696 | - // RelationalExpression(EQ/NE) |
|
| 697 | - // | |
|
| 698 | - // ------------ |
|
| 699 | - // | | |
|
| 700 | - // | | |
|
| 701 | - // CustomerID NULL |
|
| 702 | - // |
|
| 703 | - // Otherwise (In case of default PHPExpressionProvider): |
|
| 704 | - // |
|
| 705 | - // CustomerID eq null |
|
| 706 | - // ================== |
|
| 707 | - // |
|
| 708 | - // FunctionCallExpression(is_null) |
|
| 709 | - // | |
|
| 710 | - // |- Signature => bool (typeof(CustomerID)) |
|
| 711 | - // |- args => {CustomerID} |
|
| 712 | - // |
|
| 713 | - // |
|
| 714 | - // CustomerID ne null |
|
| 715 | - // ================== |
|
| 716 | - // |
|
| 717 | - // UnaryExpression (not) |
|
| 718 | - // | |
|
| 719 | - // FunctionCallExpression(is_null) |
|
| 720 | - // | |
|
| 721 | - // |- Signature => bool (typeof(CustomerID)) |
|
| 722 | - // |- args => {CustomerID} |
|
| 723 | - // |
|
| 693 | + // If the end user is responsible for implementing IExpressionProvider |
|
| 694 | + // then the sub-tree for a nullability check would be: |
|
| 695 | + // |
|
| 696 | + // RelationalExpression(EQ/NE) |
|
| 697 | + // | |
|
| 698 | + // ------------ |
|
| 699 | + // | | |
|
| 700 | + // | | |
|
| 701 | + // CustomerID NULL |
|
| 702 | + // |
|
| 703 | + // Otherwise (In case of default PHPExpressionProvider): |
|
| 704 | + // |
|
| 705 | + // CustomerID eq null |
|
| 706 | + // ================== |
|
| 707 | + // |
|
| 708 | + // FunctionCallExpression(is_null) |
|
| 709 | + // | |
|
| 710 | + // |- Signature => bool (typeof(CustomerID)) |
|
| 711 | + // |- args => {CustomerID} |
|
| 712 | + // |
|
| 713 | + // |
|
| 714 | + // CustomerID ne null |
|
| 715 | + // ================== |
|
| 716 | + // |
|
| 717 | + // UnaryExpression (not) |
|
| 718 | + // | |
|
| 719 | + // FunctionCallExpression(is_null) |
|
| 720 | + // | |
|
| 721 | + // |- Signature => bool (typeof(CustomerID)) |
|
| 722 | + // |- args => {CustomerID} |
|
| 723 | + // |
|
| 724 | 724 | if ($isPHPExpressionProvider) { |
| 725 | 725 | $arg = $left->typeIs($null) ? $right : $left; |
| 726 | 726 | $isNullFunctionDescription = new FunctionDescription('is_null', new Boolean(), array($arg->getType())); |
| 727 | 727 | switch ($expressionToken->Text) { |
| 728 | - case ODataConstants::KEYWORD_EQUAL: |
|
| 729 | - return new FunctionCallExpression($isNullFunctionDescription, array($arg)); |
|
| 730 | - break; |
|
| 731 | - |
|
| 732 | - case ODataConstants::KEYWORD_NOT_EQUAL: |
|
| 733 | - return new UnaryExpression( |
|
| 734 | - new FunctionCallExpression($isNullFunctionDescription, array($arg)), |
|
| 735 | - ExpressionType::NOT_LOGICAL, |
|
| 736 | - new Boolean() |
|
| 737 | - ); |
|
| 738 | - break; |
|
| 728 | + case ODataConstants::KEYWORD_EQUAL: |
|
| 729 | + return new FunctionCallExpression($isNullFunctionDescription, array($arg)); |
|
| 730 | + break; |
|
| 731 | + |
|
| 732 | + case ODataConstants::KEYWORD_NOT_EQUAL: |
|
| 733 | + return new UnaryExpression( |
|
| 734 | + new FunctionCallExpression($isNullFunctionDescription, array($arg)), |
|
| 735 | + ExpressionType::NOT_LOGICAL, |
|
| 736 | + new Boolean() |
|
| 737 | + ); |
|
| 738 | + break; |
|
| 739 | 739 | } |
| 740 | 740 | } |
| 741 | 741 | } |
| 742 | 742 | |
| 743 | 743 | switch ($expressionToken->Text) { |
| 744 | - case ODataConstants::KEYWORD_EQUAL: |
|
| 745 | - return new RelationalExpression( |
|
| 746 | - $left, $right, ExpressionType::EQUAL |
|
| 747 | - ); |
|
| 748 | - case ODataConstants::KEYWORD_NOT_EQUAL: |
|
| 749 | - return new RelationalExpression( |
|
| 750 | - $left, $right, ExpressionType::NOTEQUAL |
|
| 751 | - ); |
|
| 752 | - case ODataConstants::KEYWORD_GREATERTHAN: |
|
| 753 | - return new RelationalExpression( |
|
| 754 | - $left, $right, ExpressionType::GREATERTHAN |
|
| 755 | - ); |
|
| 756 | - case ODataConstants::KEYWORD_GREATERTHAN_OR_EQUAL: |
|
| 757 | - return new RelationalExpression( |
|
| 758 | - $left, $right, ExpressionType::GREATERTHAN_OR_EQUAL |
|
| 759 | - ); |
|
| 760 | - case ODataConstants::KEYWORD_LESSTHAN: |
|
| 761 | - return new RelationalExpression( |
|
| 762 | - $left, $right, ExpressionType::LESSTHAN |
|
| 763 | - ); |
|
| 764 | - default: |
|
| 765 | - return new RelationalExpression( |
|
| 766 | - $left, $right, ExpressionType::LESSTHAN_OR_EQUAL |
|
| 767 | - ); |
|
| 744 | + case ODataConstants::KEYWORD_EQUAL: |
|
| 745 | + return new RelationalExpression( |
|
| 746 | + $left, $right, ExpressionType::EQUAL |
|
| 747 | + ); |
|
| 748 | + case ODataConstants::KEYWORD_NOT_EQUAL: |
|
| 749 | + return new RelationalExpression( |
|
| 750 | + $left, $right, ExpressionType::NOTEQUAL |
|
| 751 | + ); |
|
| 752 | + case ODataConstants::KEYWORD_GREATERTHAN: |
|
| 753 | + return new RelationalExpression( |
|
| 754 | + $left, $right, ExpressionType::GREATERTHAN |
|
| 755 | + ); |
|
| 756 | + case ODataConstants::KEYWORD_GREATERTHAN_OR_EQUAL: |
|
| 757 | + return new RelationalExpression( |
|
| 758 | + $left, $right, ExpressionType::GREATERTHAN_OR_EQUAL |
|
| 759 | + ); |
|
| 760 | + case ODataConstants::KEYWORD_LESSTHAN: |
|
| 761 | + return new RelationalExpression( |
|
| 762 | + $left, $right, ExpressionType::LESSTHAN |
|
| 763 | + ); |
|
| 764 | + default: |
|
| 765 | + return new RelationalExpression( |
|
| 766 | + $left, $right, ExpressionType::LESSTHAN_OR_EQUAL |
|
| 767 | + ); |
|
| 768 | 768 | } |
| 769 | 769 | } |
| 770 | 770 | |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | $this->_lexer->nextToken(); |
| 203 | 203 | $right = $this->_parseComparison(); |
| 204 | 204 | FunctionDescription::verifyLogicalOpArguments($logicalOpToken, $left, $right); |
| 205 | - $left = new LogicalExpression($left, $right, ExpressionType::AND_LOGICAL ); |
|
| 205 | + $left = new LogicalExpression($left, $right, ExpressionType::AND_LOGICAL); |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | $this->_recurseLeave(); |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | if ($additiveToken->identifierIs(ODataConstants::KEYWORD_ADD)) { |
| 251 | 251 | $left = new ArithmeticExpression($left, $right, ExpressionType::ADD, $opReturnType); |
| 252 | 252 | } else { |
| 253 | - $left = new ArithmeticExpression($left, $right, ExpressionType::SUBTRACT, $opReturnType ); |
|
| 253 | + $left = new ArithmeticExpression($left, $right, ExpressionType::SUBTRACT, $opReturnType); |
|
| 254 | 254 | } |
| 255 | 255 | } |
| 256 | 256 | |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | && (ExpressionLexer::isNumeric($this->_getCurrentToken()->Id)) |
| 309 | 309 | ) { |
| 310 | 310 | $numberLiteral = $this->_getCurrentToken(); |
| 311 | - $numberLiteral->Text = '-' . $numberLiteral->Text; |
|
| 311 | + $numberLiteral->Text = '-'.$numberLiteral->Text; |
|
| 312 | 312 | $numberLiteral->Position = $op->Position; |
| 313 | 313 | $v = $this->_getCurrentToken(); |
| 314 | 314 | $this->_setCurrentToken($numberLiteral); |
@@ -670,7 +670,7 @@ discard block |
||
| 670 | 670 | $dateTime = new DateTime(); |
| 671 | 671 | if ($left->typeIs($dateTime) && $right->typeIs($dateTime)) { |
| 672 | 672 | $dateTimeCmpFunctions = FunctionDescription::dateTimeComparisonFunctions(); |
| 673 | - $left = new FunctionCallExpression( $dateTimeCmpFunctions[0], array($left, $right)); |
|
| 673 | + $left = new FunctionCallExpression($dateTimeCmpFunctions[0], array($left, $right)); |
|
| 674 | 674 | $right = new ConstantExpression(0, new Int32()); |
| 675 | 675 | } |
| 676 | 676 | |
@@ -363,37 +363,37 @@ |
||
| 363 | 363 | private function _parsePrimaryStart() |
| 364 | 364 | { |
| 365 | 365 | switch ($this->_lexer->getCurrentToken()->Id) { |
| 366 | - case ExpressionTokenId::BOOLEAN_LITERAL: |
|
| 367 | - return $this->_parseTypedLiteral(new Boolean()); |
|
| 368 | - case ExpressionTokenId::DATETIME_LITERAL: |
|
| 369 | - return $this->_parseTypedLiteral(new DateTime()); |
|
| 370 | - case ExpressionTokenId::DECIMAL_LITERAL: |
|
| 371 | - return $this->_parseTypedLiteral(new Decimal()); |
|
| 372 | - case ExpressionTokenId::NULL_LITERAL: |
|
| 373 | - return $this->_parseNullLiteral(); |
|
| 374 | - case ExpressionTokenId::IDENTIFIER: |
|
| 375 | - return $this->_parseIdentifier(); |
|
| 376 | - case ExpressionTokenId::STRING_LITERAL: |
|
| 377 | - return $this->_parseTypedLiteral(new StringType()); |
|
| 378 | - case ExpressionTokenId::INT64_LITERAL: |
|
| 379 | - return $this->_parseTypedLiteral(new Int64()); |
|
| 380 | - case ExpressionTokenId::INTEGER_LITERAL: |
|
| 381 | - return $this->_parseTypedLiteral(new Int32()); |
|
| 382 | - case ExpressionTokenId::DOUBLE_LITERAL: |
|
| 383 | - return $this->_parseTypedLiteral(new Double()); |
|
| 384 | - case ExpressionTokenId::SINGLE_LITERAL: |
|
| 385 | - return $this->_parseTypedLiteral(new Single()); |
|
| 386 | - case ExpressionTokenId::GUID_LITERAL: |
|
| 387 | - return $this->_parseTypedLiteral(new Guid()); |
|
| 388 | - case ExpressionTokenId::BINARY_LITERAL: |
|
| 389 | - throw new NotImplementedException( |
|
| 390 | - 'Support for binary is not implemented' |
|
| 391 | - ); |
|
| 392 | - //return $this->_parseTypedLiteral(new Binary()); |
|
| 393 | - case ExpressionTokenId::OPENPARAM: |
|
| 394 | - return $this->_parseParenExpression(); |
|
| 395 | - default: |
|
| 396 | - throw ODataException::createSyntaxError("Expression expected."); |
|
| 366 | + case ExpressionTokenId::BOOLEAN_LITERAL: |
|
| 367 | + return $this->_parseTypedLiteral(new Boolean()); |
|
| 368 | + case ExpressionTokenId::DATETIME_LITERAL: |
|
| 369 | + return $this->_parseTypedLiteral(new DateTime()); |
|
| 370 | + case ExpressionTokenId::DECIMAL_LITERAL: |
|
| 371 | + return $this->_parseTypedLiteral(new Decimal()); |
|
| 372 | + case ExpressionTokenId::NULL_LITERAL: |
|
| 373 | + return $this->_parseNullLiteral(); |
|
| 374 | + case ExpressionTokenId::IDENTIFIER: |
|
| 375 | + return $this->_parseIdentifier(); |
|
| 376 | + case ExpressionTokenId::STRING_LITERAL: |
|
| 377 | + return $this->_parseTypedLiteral(new StringType()); |
|
| 378 | + case ExpressionTokenId::INT64_LITERAL: |
|
| 379 | + return $this->_parseTypedLiteral(new Int64()); |
|
| 380 | + case ExpressionTokenId::INTEGER_LITERAL: |
|
| 381 | + return $this->_parseTypedLiteral(new Int32()); |
|
| 382 | + case ExpressionTokenId::DOUBLE_LITERAL: |
|
| 383 | + return $this->_parseTypedLiteral(new Double()); |
|
| 384 | + case ExpressionTokenId::SINGLE_LITERAL: |
|
| 385 | + return $this->_parseTypedLiteral(new Single()); |
|
| 386 | + case ExpressionTokenId::GUID_LITERAL: |
|
| 387 | + return $this->_parseTypedLiteral(new Guid()); |
|
| 388 | + case ExpressionTokenId::BINARY_LITERAL: |
|
| 389 | + throw new NotImplementedException( |
|
| 390 | + 'Support for binary is not implemented' |
|
| 391 | + ); |
|
| 392 | + //return $this->_parseTypedLiteral(new Binary()); |
|
| 393 | + case ExpressionTokenId::OPENPARAM: |
|
| 394 | + return $this->_parseParenExpression(); |
|
| 395 | + default: |
|
| 396 | + throw ODataException::createSyntaxError("Expression expected."); |
|
| 397 | 397 | } |
| 398 | 398 | } |
| 399 | 399 | |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | * @param ArithmeticExpression $expression The arithmetic expression node |
| 177 | 177 | * to process. |
| 178 | 178 | * |
| 179 | - * @return LogicalExpression|null |
|
| 179 | + * @return AbstractExpression|null |
|
| 180 | 180 | */ |
| 181 | 181 | private function _processArithmeticNode(ArithmeticExpression $expression) |
| 182 | 182 | { |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | * @param AbstractExpression $parentExpression The parent expression of |
| 211 | 211 | * expression node to process. |
| 212 | 212 | * |
| 213 | - * @return LogicalExpression|null |
|
| 213 | + * @return null|AbstractExpression |
|
| 214 | 214 | */ |
| 215 | 215 | private function _processFunctionCallNode(FunctionCallExpression $expression, |
| 216 | 216 | $parentExpression |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | * @param AbstractExpression $parentExpression The parent expression of |
| 262 | 262 | * expression node to process. |
| 263 | 263 | * |
| 264 | - * @return LogicalExpression|null |
|
| 264 | + * @return null|AbstractExpression |
|
| 265 | 265 | */ |
| 266 | 266 | private function _processLogicalNode( |
| 267 | 267 | LogicalExpression $expression, $parentExpression |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | * @param AbstractExpression $parentExpression The parent expression of |
| 365 | 365 | * expression node to process. |
| 366 | 366 | * |
| 367 | - * @return LogicalExpression|null |
|
| 367 | + * @return null|AbstractExpression |
|
| 368 | 368 | */ |
| 369 | 369 | private function _processRelationalNode(RelationalExpression $expression, |
| 370 | 370 | $parentExpression |
@@ -411,7 +411,7 @@ discard block |
||
| 411 | 411 | * @param AbstractExpression $parentExpression The parent expression of |
| 412 | 412 | * expression node to process. |
| 413 | 413 | * |
| 414 | - * @return LogicalExpression|null |
|
| 414 | + * @return AbstractExpression|null |
|
| 415 | 415 | */ |
| 416 | 416 | private function _processUnaryNode(UnaryExpression $expression, |
| 417 | 417 | $parentExpression |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | * @param AbstractExpression $nullCheckExpTree1 First expression. |
| 455 | 455 | * @param AbstractExpression $nullCheckExpTree2 Second expression. |
| 456 | 456 | * |
| 457 | - * @return UnaryExpression|LogicalExpression |
|
| 457 | + * @return AbstractExpression |
|
| 458 | 458 | */ |
| 459 | 459 | private function _mergeNullableExpressionTrees($nullCheckExpTree1, |
| 460 | 460 | $nullCheckExpTree2 |
@@ -8,7 +8,6 @@ |
||
| 8 | 8 | use POData\Providers\Expression\PHPExpressionProvider; |
| 9 | 9 | use POData\Providers\Metadata\Type\Boolean; |
| 10 | 10 | use POData\Providers\Metadata\ResourceType; |
| 11 | -use POData\Providers\Metadata\ResourceTypeKind; |
|
| 12 | 11 | use POData\UriProcessor\QueryProcessor\ExpressionParser\Expressions\AbstractExpression; |
| 13 | 12 | use POData\UriProcessor\QueryProcessor\ExpressionParser\Expressions\ArithmeticExpression; |
| 14 | 13 | use POData\UriProcessor\QueryProcessor\ExpressionParser\Expressions\LogicalExpression; |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | } |
| 309 | 309 | |
| 310 | 310 | if ($resultExpression == null) { |
| 311 | - return null; |
|
| 311 | + return null; |
|
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | if ($parentExpression == null) { |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | } |
| 390 | 390 | |
| 391 | 391 | if ($resultExpression == null) { |
| 392 | - return null; |
|
| 392 | + return null; |
|
| 393 | 393 | } |
| 394 | 394 | |
| 395 | 395 | if ($parentExpression == null) { |
@@ -93,9 +93,9 @@ discard block |
||
| 93 | 93 | $expressionProcessor = new ExpressionProcessor($expressionProvider); |
| 94 | 94 | |
| 95 | 95 | try { |
| 96 | - $expressionAsString = $expressionProcessor->processExpression( $expressionTree ); |
|
| 96 | + $expressionAsString = $expressionProcessor->processExpression($expressionTree); |
|
| 97 | 97 | } catch (\InvalidArgumentException $invalidArgumentException) { |
| 98 | - throw ODataException::createInternalServerError( $invalidArgumentException->getMessage() ); |
|
| 98 | + throw ODataException::createInternalServerError($invalidArgumentException->getMessage()); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | |
@@ -518,7 +518,7 @@ discard block |
||
| 518 | 518 | $parent = $nullCheckExpTree; |
| 519 | 519 | $key = null; |
| 520 | 520 | do { |
| 521 | - $key = $parent->getResourceProperty()->getName() . '_' . $key; |
|
| 521 | + $key = $parent->getResourceProperty()->getName().'_'.$key; |
|
| 522 | 522 | $parent = $parent->getParent(); |
| 523 | 523 | } while ($parent != null); |
| 524 | 524 | |
@@ -3,7 +3,6 @@ |
||
| 3 | 3 | namespace POData\UriProcessor\QueryProcessor\ExpressionParser; |
| 4 | 4 | |
| 5 | 5 | use POData\Providers\Expression\IExpressionProvider; |
| 6 | -use POData\UriProcessor\QueryProcessor\ExpressionParser\Expressions\PropertyNullabilityCheckExpression; |
|
| 7 | 6 | use POData\UriProcessor\QueryProcessor\ExpressionParser\Expressions\AbstractExpression; |
| 8 | 7 | use POData\UriProcessor\QueryProcessor\ExpressionParser\Expressions\ArithmeticExpression; |
| 9 | 8 | use POData\UriProcessor\QueryProcessor\ExpressionParser\Expressions\LogicalExpression; |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | * @param AbstractExpression $left left expression |
| 18 | 18 | * @param AbstractExpression $right right Expression |
| 19 | 19 | * @param ExpressionType $nodeType Expression node type |
| 20 | - * @param IType $type Expression type |
|
| 20 | + * @param \POData\Providers\Metadata\Type\IType $type Expression type |
|
| 21 | 21 | */ |
| 22 | 22 | public function __construct($left, $right, $nodeType, $type) |
| 23 | 23 | { |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | * Create new inatnce of ConstantExpression. |
| 19 | 19 | * |
| 20 | 20 | * @param string $value The constant value |
| 21 | - * @param IType $type The expression node type |
|
| 21 | + * @param \POData\Providers\Metadata\Type\IType $type The expression node type |
|
| 22 | 22 | */ |
| 23 | 23 | public function __construct($value, $type) |
| 24 | 24 | { |
@@ -97,7 +97,7 @@ |
||
| 97 | 97 | /** |
| 98 | 98 | * Get the resource type of the property hold by this expression |
| 99 | 99 | * |
| 100 | - * @return ResourceType |
|
| 100 | + * @return \POData\Providers\Metadata\ResourceType |
|
| 101 | 101 | */ |
| 102 | 102 | public function getResourceType() |
| 103 | 103 | { |