@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | /** |
| 256 | 256 | * Get function description for string comparison |
| 257 | 257 | * |
| 258 | - * @return \POData\UriProcessor\QueryProcessor\FunctionDescription[] |
|
| 258 | + * @return FunctionDescription[] |
|
| 259 | 259 | */ |
| 260 | 260 | public static function stringComparisonFunctions() |
| 261 | 261 | { |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | /** |
| 271 | 271 | * Get function description for datetime comparison |
| 272 | 272 | * |
| 273 | - * @return \POData\UriProcessor\QueryProcessor\FunctionDescription[] |
|
| 273 | + * @return FunctionDescription[] |
|
| 274 | 274 | */ |
| 275 | 275 | public static function dateTimeComparisonFunctions() |
| 276 | 276 | { |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | /** |
| 286 | 286 | * Get function description for guid equality check |
| 287 | 287 | * |
| 288 | - * @return \POData\UriProcessor\QueryProcessor\FunctionDescription[] |
|
| 288 | + * @return FunctionDescription[] |
|
| 289 | 289 | */ |
| 290 | 290 | public static function guidEqualityFunctions() |
| 291 | 291 | { |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | /** |
| 301 | 301 | * Get function description for binary equality check |
| 302 | 302 | * |
| 303 | - * @return \POData\UriProcessor\QueryProcessor\FunctionDescription[] |
|
| 303 | + * @return FunctionDescription[] |
|
| 304 | 304 | */ |
| 305 | 305 | public static function binaryEqualityFunctions() |
| 306 | 306 | { |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | /** |
| 316 | 316 | * Get function descriptions for arithmetic operations |
| 317 | 317 | * |
| 318 | - * @return \POData\UriProcessor\QueryProcessor\FunctionDescription[] |
|
| 318 | + * @return FunctionDescription[] |
|
| 319 | 319 | */ |
| 320 | 320 | public static function arithmeticOperationFunctions() |
| 321 | 321 | { |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | /** |
| 351 | 351 | * Get function descriptions for arithmetic add operations |
| 352 | 352 | * |
| 353 | - * @return \POData\UriProcessor\QueryProcessor\FunctionDescription[] indexed by function name |
|
| 353 | + * @return FunctionDescription[] indexed by function name |
|
| 354 | 354 | */ |
| 355 | 355 | public static function addOperationFunctions() |
| 356 | 356 | { |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | /** |
| 361 | 361 | * Get function descriptions for arithmetic subtract operations |
| 362 | 362 | * |
| 363 | - * @return \POData\UriProcessor\QueryProcessor\FunctionDescription[] indexed by function name |
|
| 363 | + * @return FunctionDescription[] indexed by function name |
|
| 364 | 364 | */ |
| 365 | 365 | public static function subtractOperationFunctions() |
| 366 | 366 | { |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | /** |
| 371 | 371 | * Get function descriptions for logical operations |
| 372 | 372 | * |
| 373 | - * @return \POData\UriProcessor\QueryProcessor\FunctionDescription[] |
|
| 373 | + * @return FunctionDescription[] |
|
| 374 | 374 | */ |
| 375 | 375 | public static function logicalOperationFunctions() |
| 376 | 376 | { |
@@ -385,7 +385,7 @@ discard block |
||
| 385 | 385 | /** |
| 386 | 386 | * Get function descriptions for relational operations |
| 387 | 387 | * |
| 388 | - * @return \POData\UriProcessor\QueryProcessor\FunctionDescription[] |
|
| 388 | + * @return FunctionDescription[] |
|
| 389 | 389 | */ |
| 390 | 390 | public static function relationalOperationFunctions() |
| 391 | 391 | { |
@@ -415,7 +415,7 @@ discard block |
||
| 415 | 415 | /** |
| 416 | 416 | * Get function descriptions for unary not operation |
| 417 | 417 | * |
| 418 | - * @return \POData\UriProcessor\QueryProcessor\FunctionDescription[] |
|
| 418 | + * @return FunctionDescription[] |
|
| 419 | 419 | */ |
| 420 | 420 | public static function notOperationFunctions() |
| 421 | 421 | { |
@@ -442,7 +442,7 @@ discard block |
||
| 442 | 442 | /** |
| 443 | 443 | * Get function description for unary negate operator |
| 444 | 444 | * |
| 445 | - * @return \POData\UriProcessor\QueryProcessor\FunctionDescription[] |
|
| 445 | + * @return FunctionDescription[] |
|
| 446 | 446 | */ |
| 447 | 447 | public static function negateOperationFunctions() |
| 448 | 448 | { |
@@ -657,7 +657,7 @@ discard block |
||
| 657 | 657 | * |
| 658 | 658 | * @throws ODataException |
| 659 | 659 | * |
| 660 | - * @return \POData\UriProcessor\QueryProcessor\FunctionDescription[] Array of matching functions |
|
| 660 | + * @return FunctionDescription[] Array of matching functions |
|
| 661 | 661 | */ |
| 662 | 662 | public static function verifyFunctionExists($expressionToken) |
| 663 | 663 | { |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | { |
| 72 | 72 | $str = $this->returnType->getFullTypeName() . ' ' . $this->name . '('; |
| 73 | 73 | |
| 74 | - foreach ($this->argumentTypes as $argumentType) { |
|
| 74 | + foreach ($this->argumentTypes as $argumentType) { |
|
| 75 | 75 | $str .= $argumentType->getFullTypeName() . ', '; |
| 76 | 76 | } |
| 77 | 77 | |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | array(new Double()) |
| 248 | 248 | ) |
| 249 | 249 | ) |
| 250 | - ); |
|
| 250 | + ); |
|
| 251 | 251 | |
| 252 | 252 | return $functions; |
| 253 | 253 | } |
@@ -69,13 +69,13 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | public function getPrototypeAsString() |
| 71 | 71 | { |
| 72 | - $str = $this->returnType->getFullTypeName() . ' ' . $this->name . '('; |
|
| 72 | + $str = $this->returnType->getFullTypeName().' '.$this->name.'('; |
|
| 73 | 73 | |
| 74 | 74 | foreach ($this->argumentTypes as $argumentType) { |
| 75 | - $str .= $argumentType->getFullTypeName() . ', '; |
|
| 75 | + $str .= $argumentType->getFullTypeName().', '; |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - return rtrim($str, ', ') . ')'; |
|
| 78 | + return rtrim($str, ', ').')'; |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | /** |
@@ -469,7 +469,7 @@ discard block |
||
| 469 | 469 | { |
| 470 | 470 | $string = null; |
| 471 | 471 | foreach ($argExpressions as $argExpression) { |
| 472 | - $string .= $argExpression->getType()->getFullTypeName() . ', '; |
|
| 472 | + $string .= $argExpression->getType()->getFullTypeName().', '; |
|
| 473 | 473 | } |
| 474 | 474 | |
| 475 | 475 | $string = rtrim($string, ', '); |
@@ -630,7 +630,7 @@ discard block |
||
| 630 | 630 | public static function validateUnaryOpArguments($expressionToken, $argExpression) |
| 631 | 631 | { |
| 632 | 632 | //Unary not |
| 633 | - if (strcmp($expressionToken->Text, ODataConstants::KEYWORD_NOT) == 0 ) { |
|
| 633 | + if (strcmp($expressionToken->Text, ODataConstants::KEYWORD_NOT) == 0) { |
|
| 634 | 634 | $function = self::findFunctionWithPromotion( |
| 635 | 635 | self::notOperationFunctions(), |
| 636 | 636 | array($argExpression) |
@@ -671,7 +671,7 @@ discard block |
||
| 671 | 671 | |
| 672 | 672 | } |
| 673 | 673 | |
| 674 | - $filterFunctions = self::filterFunctionDescriptions(); |
|
| 674 | + $filterFunctions = self::filterFunctionDescriptions(); |
|
| 675 | 675 | return $filterFunctions[$expressionToken->Text]; |
| 676 | 676 | } |
| 677 | 677 | |
@@ -695,7 +695,7 @@ discard block |
||
| 695 | 695 | if ($function == null) { |
| 696 | 696 | $protoTypes = null; |
| 697 | 697 | foreach ($functions as $function) { |
| 698 | - $protoTypes .= $function->getPrototypeAsString() . '; '; |
|
| 698 | + $protoTypes .= $function->getPrototypeAsString().'; '; |
|
| 699 | 699 | } |
| 700 | 700 | |
| 701 | 701 | throw ODataException::createSyntaxError( |
@@ -6,7 +6,6 @@ discard block |
||
| 6 | 6 | use POData\Common\Messages; |
| 7 | 7 | use POData\Common\ODataConstants; |
| 8 | 8 | use POData\Providers\Metadata\Type\Null1; |
| 9 | -use POData\Providers\Metadata\Type\INavigationType; |
|
| 10 | 9 | use POData\Providers\Metadata\Type\Int64; |
| 11 | 10 | use POData\Providers\Metadata\Type\Int16; |
| 12 | 11 | use POData\Providers\Metadata\Type\Guid; |
@@ -17,10 +16,8 @@ discard block |
||
| 17 | 16 | use POData\Providers\Metadata\Type\Int32; |
| 18 | 17 | use POData\Providers\Metadata\Type\StringType; |
| 19 | 18 | use POData\Providers\Metadata\Type\Boolean; |
| 20 | -use POData\Providers\Metadata\Type\VoidType; |
|
| 21 | 19 | use POData\Providers\Metadata\Type\Binary; |
| 22 | 20 | use POData\Providers\Metadata\Type\IType; |
| 23 | -use POData\UriProcessor\QueryProcessor\ExpressionParser\Expressions\ExpressionType; |
|
| 24 | 21 | use POData\UriProcessor\QueryProcessor\ExpressionParser\Expressions\AbstractExpression; |
| 25 | 22 | use POData\UriProcessor\QueryProcessor\ExpressionParser\ExpressionToken; |
| 26 | 23 | |
@@ -2,7 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace POData\UriProcessor\QueryProcessor\OrderByParser; |
| 4 | 4 | use POData\Common\Messages; |
| 5 | -use POData\Common\InvalidOperationException; |
|
| 6 | 5 | |
| 7 | 6 | /** |
| 8 | 7 | * Class OrderByInfo |
@@ -72,7 +72,7 @@ |
||
| 72 | 72 | * |
| 73 | 73 | * @see library/POData/QueryProcessorOrderByParser.OrderByBaseNode::getResourceType() |
| 74 | 74 | * |
| 75 | - * @return void |
|
| 75 | + * @return \POData\Providers\Metadata\ResourceType |
|
| 76 | 76 | */ |
| 77 | 77 | public function getResourceType() |
| 78 | 78 | { |
@@ -111,25 +111,25 @@ |
||
| 111 | 111 | |
| 112 | 112 | foreach ($ancestors as $i => $anscestor) { |
| 113 | 113 | if ($i == 0) { |
| 114 | - $parameterNames = array ( |
|
| 115 | - '$' . $anscestor . 'A', '$' . $anscestor . 'B' |
|
| 114 | + $parameterNames = array( |
|
| 115 | + '$'.$anscestor.'A', '$'.$anscestor.'B' |
|
| 116 | 116 | ); |
| 117 | 117 | $accessor1 = $parameterNames[0]; |
| 118 | 118 | $accessor2 = $parameterNames[1]; |
| 119 | - $flag1 = '$flag1 = ' . 'is_null(' . $accessor1. ') || '; |
|
| 120 | - $flag2 = '$flag2 = ' . 'is_null(' . $accessor2. ') || '; |
|
| 119 | + $flag1 = '$flag1 = '.'is_null('.$accessor1.') || '; |
|
| 120 | + $flag2 = '$flag2 = '.'is_null('.$accessor2.') || '; |
|
| 121 | 121 | } else { |
| 122 | - $accessor1 .= '->' . $anscestor; |
|
| 123 | - $accessor2 .= '->' . $anscestor; |
|
| 124 | - $flag1 .= 'is_null(' .$accessor1 . ')' . ' || '; |
|
| 125 | - $flag2 .= 'is_null(' .$accessor2 . ')' . ' || '; |
|
| 122 | + $accessor1 .= '->'.$anscestor; |
|
| 123 | + $accessor2 .= '->'.$anscestor; |
|
| 124 | + $flag1 .= 'is_null('.$accessor1.')'.' || '; |
|
| 125 | + $flag2 .= 'is_null('.$accessor2.')'.' || '; |
|
| 126 | 126 | } |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - $accessor1 .= '->' . $this->propertyName; |
|
| 130 | - $accessor2 .= '->' . $this->propertyName; |
|
| 131 | - $flag1 .= 'is_null(' . $accessor1 . ')'; |
|
| 132 | - $flag2 .= 'is_null(' . $accessor2 . ')'; |
|
| 129 | + $accessor1 .= '->'.$this->propertyName; |
|
| 130 | + $accessor2 .= '->'.$this->propertyName; |
|
| 131 | + $flag1 .= 'is_null('.$accessor1.')'; |
|
| 132 | + $flag2 .= 'is_null('.$accessor2.')'; |
|
| 133 | 133 | |
| 134 | 134 | $code = "$flag1; |
| 135 | 135 | $flag2; |
@@ -89,7 +89,7 @@ |
||
| 89 | 89 | * |
| 90 | 90 | * @see library/POData/QueryProcessorOrderByParser.OrderByBaseNode::getResourceType() |
| 91 | 91 | * |
| 92 | - * @return ResourceType |
|
| 92 | + * @return \POData\Providers\Metadata\ResourceType |
|
| 93 | 93 | */ |
| 94 | 94 | public function getResourceType() |
| 95 | 95 | { |
@@ -10,7 +10,6 @@ |
||
| 10 | 10 | use POData\UriProcessor\QueryProcessor\SkipTokenParser\SkipTokenParser; |
| 11 | 11 | use POData\UriProcessor\QueryProcessor\OrderByParser\OrderByParser; |
| 12 | 12 | use POData\UriProcessor\QueryProcessor\ExpressionParser\ExpressionParser2; |
| 13 | -use POData\UriProcessor\QueryProcessor\ExpressionParser\FilterInfo; |
|
| 14 | 13 | use POData\UriProcessor\QueryProcessor\ExpandProjectionParser\ExpandProjectionParser; |
| 15 | 14 | use POData\Common\Messages; |
| 16 | 15 | use POData\Common\ODataException; |
@@ -71,21 +71,21 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | $isSingleResult = $request->isSingleResult(); |
| 73 | 73 | |
| 74 | - //$top, $skip, $order, $inlinecount & $count are only applicable if: |
|
| 75 | - //The query targets a resource collection |
|
| 74 | + //$top, $skip, $order, $inlinecount & $count are only applicable if: |
|
| 75 | + //The query targets a resource collection |
|
| 76 | 76 | $this->_setQueryApplicable = ($request->getTargetKind() == TargetKind::RESOURCE() && !$isSingleResult); |
| 77 | - //Or it's a $count resource (although $inlinecount isn't applicable in this case..but there's a check somewhere else for this |
|
| 78 | - $this->_setQueryApplicable |= $request->queryType == QueryType::COUNT(); |
|
| 77 | + //Or it's a $count resource (although $inlinecount isn't applicable in this case..but there's a check somewhere else for this |
|
| 78 | + $this->_setQueryApplicable |= $request->queryType == QueryType::COUNT(); |
|
| 79 | 79 | |
| 80 | - //Paging is allowed if |
|
| 81 | - //The request targets a resource collection |
|
| 82 | - //and the request isn't for a $count segment |
|
| 83 | - $this->_pagingApplicable = $this->request->getTargetKind() == TargetKind::RESOURCE() && !$isSingleResult && ($request->queryType != QueryType::COUNT()); |
|
| 80 | + //Paging is allowed if |
|
| 81 | + //The request targets a resource collection |
|
| 82 | + //and the request isn't for a $count segment |
|
| 83 | + $this->_pagingApplicable = $this->request->getTargetKind() == TargetKind::RESOURCE() && !$isSingleResult && ($request->queryType != QueryType::COUNT()); |
|
| 84 | 84 | |
| 85 | - $targetResourceType = $this->request->getTargetResourceType(); |
|
| 85 | + $targetResourceType = $this->request->getTargetResourceType(); |
|
| 86 | 86 | $targetResourceSetWrapper = $this->request->getTargetResourceSetWrapper(); |
| 87 | 87 | |
| 88 | - $this->_expandSelectApplicable = !is_null($targetResourceType) |
|
| 88 | + $this->_expandSelectApplicable = !is_null($targetResourceType) |
|
| 89 | 89 | && !is_null($targetResourceSetWrapper) |
| 90 | 90 | && $targetResourceType->getResourceTypeKind() == ResourceTypeKind::ENTITY |
| 91 | 91 | && !$this->request->isLinkUri(); |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | || $kind == TargetKind::COMPLEX_OBJECT() |
| 271 | 271 | || $this->request->queryType == QueryType::COUNT() ) |
| 272 | 272 | ) { |
| 273 | - throw ODataException::createBadRequestError( |
|
| 273 | + throw ODataException::createBadRequestError( |
|
| 274 | 274 | Messages::queryProcessorQueryFilterOptionNotApplicable() |
| 275 | 275 | ); |
| 276 | 276 | } |
@@ -296,27 +296,27 @@ discard block |
||
| 296 | 296 | { |
| 297 | 297 | $inlineCount = $this->service->getHost()->getQueryStringItem( ODataConstants::HTTPQUERY_STRING_INLINECOUNT ); |
| 298 | 298 | |
| 299 | - //If it's not specified, we're done |
|
| 300 | - if(is_null($inlineCount)) return; |
|
| 299 | + //If it's not specified, we're done |
|
| 300 | + if(is_null($inlineCount)) return; |
|
| 301 | 301 | |
| 302 | - //If the service doesn't allow count requests..then throw an exception |
|
| 302 | + //If the service doesn't allow count requests..then throw an exception |
|
| 303 | 303 | if (!$this->service->getConfiguration()->getAcceptCountRequests()) { |
| 304 | - throw ODataException::createBadRequestError( |
|
| 304 | + throw ODataException::createBadRequestError( |
|
| 305 | 305 | Messages::configurationCountNotAccepted() |
| 306 | 306 | ); |
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | $inlineCount = trim($inlineCount); |
| 310 | 310 | |
| 311 | - //if it's set to none, we don't do inline counts |
|
| 311 | + //if it's set to none, we don't do inline counts |
|
| 312 | 312 | if ($inlineCount === ODataConstants::URI_ROWCOUNT_OFFOPTION) { |
| 313 | 313 | return; |
| 314 | 314 | } |
| 315 | 315 | |
| 316 | - //You can't specify $count & $inlinecount together |
|
| 317 | - //TODO: ensure there's a test for this case see #55 |
|
| 316 | + //You can't specify $count & $inlinecount together |
|
| 317 | + //TODO: ensure there's a test for this case see #55 |
|
| 318 | 318 | if ($this->request->queryType == QueryType::COUNT() ) { |
| 319 | - throw ODataException::createBadRequestError( |
|
| 319 | + throw ODataException::createBadRequestError( |
|
| 320 | 320 | Messages::queryProcessorInlineCountWithValueCount() |
| 321 | 321 | ); |
| 322 | 322 | } |
@@ -325,13 +325,13 @@ discard block |
||
| 325 | 325 | |
| 326 | 326 | |
| 327 | 327 | if ($inlineCount === ODataConstants::URI_ROWCOUNT_ALLOPTION) { |
| 328 | - $this->request->queryType = QueryType::ENTITIES_WITH_COUNT(); |
|
| 328 | + $this->request->queryType = QueryType::ENTITIES_WITH_COUNT(); |
|
| 329 | 329 | |
| 330 | 330 | $this->request->raiseMinVersionRequirement( 2, 0 ); |
| 331 | 331 | $this->request->raiseResponseVersion( 2, 0 ); |
| 332 | 332 | |
| 333 | 333 | } else { |
| 334 | - throw ODataException::createBadRequestError( |
|
| 334 | + throw ODataException::createBadRequestError( |
|
| 335 | 335 | Messages::queryProcessorInvalidInlineCountOptionError() |
| 336 | 336 | ); |
| 337 | 337 | } |
@@ -361,13 +361,13 @@ discard block |
||
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | if (!$this->_pagingApplicable) { |
| 364 | - throw ODataException::createBadRequestError( |
|
| 364 | + throw ODataException::createBadRequestError( |
|
| 365 | 365 | Messages::queryProcessorSkipTokenNotAllowed() |
| 366 | 366 | ); |
| 367 | 367 | } |
| 368 | 368 | |
| 369 | 369 | if (!$this->_isSSPagingRequired()) { |
| 370 | - throw ODataException::createBadRequestError( |
|
| 370 | + throw ODataException::createBadRequestError( |
|
| 371 | 371 | Messages::queryProcessorSkipTokenCannotBeAppliedForNonPagedResourceSet($this->request->getTargetResourceSetWrapper()) |
| 372 | 372 | ); |
| 373 | 373 | } |
@@ -412,7 +412,7 @@ discard block |
||
| 412 | 412 | |
| 413 | 413 | if (!is_null($select)) { |
| 414 | 414 | if (!$this->service->getConfiguration()->getAcceptProjectionRequests()) { |
| 415 | - throw ODataException::createBadRequestError( Messages::configurationProjectionsNotAccepted() ); |
|
| 415 | + throw ODataException::createBadRequestError( Messages::configurationProjectionsNotAccepted() ); |
|
| 416 | 416 | } |
| 417 | 417 | |
| 418 | 418 | $this->_checkExpandOrSelectApplicable( ODataConstants::HTTPQUERY_STRING_SELECT ); |
@@ -423,19 +423,19 @@ discard block |
||
| 423 | 423 | // 'RootProjectionNode' is required while generating next page Link |
| 424 | 424 | if ($this->_expandSelectApplicable || $this->request->isLinkUri() ) { |
| 425 | 425 | |
| 426 | - $rootProjectionNode = ExpandProjectionParser::parseExpandAndSelectClause( |
|
| 427 | - $this->request->getTargetResourceSetWrapper(), |
|
| 428 | - $this->request->getTargetResourceType(), |
|
| 429 | - $this->request->getInternalOrderByInfo(), |
|
| 430 | - $this->request->getSkipCount(), |
|
| 431 | - $this->request->getTopCount(), |
|
| 432 | - $expand, |
|
| 433 | - $select, |
|
| 434 | - $this->service->getProvidersWrapper() |
|
| 435 | - ); |
|
| 436 | - if ($rootProjectionNode->isSelectionSpecified()) { |
|
| 437 | - $this->request->raiseMinVersionRequirement(2, 0 ); |
|
| 438 | - } |
|
| 426 | + $rootProjectionNode = ExpandProjectionParser::parseExpandAndSelectClause( |
|
| 427 | + $this->request->getTargetResourceSetWrapper(), |
|
| 428 | + $this->request->getTargetResourceType(), |
|
| 429 | + $this->request->getInternalOrderByInfo(), |
|
| 430 | + $this->request->getSkipCount(), |
|
| 431 | + $this->request->getTopCount(), |
|
| 432 | + $expand, |
|
| 433 | + $select, |
|
| 434 | + $this->service->getProvidersWrapper() |
|
| 435 | + ); |
|
| 436 | + if ($rootProjectionNode->isSelectionSpecified()) { |
|
| 437 | + $this->request->raiseMinVersionRequirement(2, 0 ); |
|
| 438 | + } |
|
| 439 | 439 | |
| 440 | 440 | if ($rootProjectionNode->hasPagedExpandedResult()) { |
| 441 | 441 | $this->request->raiseResponseVersion( 2, 0 ); |
@@ -533,7 +533,7 @@ discard block |
||
| 533 | 533 | || !is_null($serviceHost->getQueryStringItem(ODataConstants::HTTPQUERY_STRING_SKIPTOKEN)) |
| 534 | 534 | || !is_null($serviceHost->getQueryStringItem(ODataConstants::HTTPQUERY_STRING_TOP)) |
| 535 | 535 | ) { |
| 536 | - throw ODataException::createBadRequestError( |
|
| 536 | + throw ODataException::createBadRequestError( |
|
| 537 | 537 | Messages::queryProcessorNoQueryOptionsApplicable() |
| 538 | 538 | ); |
| 539 | 539 | } |
@@ -551,7 +551,7 @@ discard block |
||
| 551 | 551 | private function _checkSetQueryApplicable() |
| 552 | 552 | { |
| 553 | 553 | if (!$this->_setQueryApplicable) { |
| 554 | - throw ODataException::createBadRequestError( |
|
| 554 | + throw ODataException::createBadRequestError( |
|
| 555 | 555 | Messages::queryProcessorQuerySetOptionsNotApplicable() |
| 556 | 556 | ); |
| 557 | 557 | } |
@@ -572,7 +572,7 @@ discard block |
||
| 572 | 572 | private function _checkExpandOrSelectApplicable($queryItem) |
| 573 | 573 | { |
| 574 | 574 | if (!$this->_expandSelectApplicable) { |
| 575 | - throw ODataException::createBadRequestError( |
|
| 575 | + throw ODataException::createBadRequestError( |
|
| 576 | 576 | Messages::queryProcessorSelectOrExpandOptionNotApplicable($queryItem) |
| 577 | 577 | ); |
| 578 | 578 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | * @param RequestDescription $request Description of the request submitted by client. |
| 66 | 66 | * @param IService $service Reference to the service implementation. |
| 67 | 67 | */ |
| 68 | - private function __construct(RequestDescription $request, IService $service ) { |
|
| 68 | + private function __construct(RequestDescription $request, IService $service) { |
|
| 69 | 69 | $this->request = $request; |
| 70 | 70 | $this->service = $service; |
| 71 | 71 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | * |
| 103 | 103 | * @throws ODataException |
| 104 | 104 | */ |
| 105 | - public static function process(RequestDescription $request, IService $service ) { |
|
| 105 | + public static function process(RequestDescription $request, IService $service) { |
|
| 106 | 106 | $queryProcessor = new QueryProcessor($request, $service); |
| 107 | 107 | if ($request->getTargetSource() == TargetSource::NONE) { |
| 108 | 108 | //A service directory, metadata or batch request |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | private function _processSkipAndTop() |
| 149 | 149 | { |
| 150 | 150 | $value = null; |
| 151 | - if ($this->_readSkipOrTopOption( ODataConstants::HTTPQUERY_STRING_SKIP, $value ) ) { |
|
| 151 | + if ($this->_readSkipOrTopOption(ODataConstants::HTTPQUERY_STRING_SKIP, $value)) { |
|
| 152 | 152 | $this->request->setSkipCount($value); |
| 153 | 153 | } |
| 154 | 154 | |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | ->getResourceSetPageSize(); |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | - if ($this->_readSkipOrTopOption(ODataConstants::HTTPQUERY_STRING_TOP, $value) ) { |
|
| 163 | + if ($this->_readSkipOrTopOption(ODataConstants::HTTPQUERY_STRING_TOP, $value)) { |
|
| 164 | 164 | $this->request->setTopOptionCount($value); |
| 165 | 165 | if ($isPagingRequired && $pageSize < $value) { |
| 166 | 166 | //If $top is greater than or equal to page size, |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | */ |
| 197 | 197 | private function _processOrderBy() |
| 198 | 198 | { |
| 199 | - $orderBy = $this->service->getHost()->getQueryStringItem( ODataConstants::HTTPQUERY_STRING_ORDERBY ); |
|
| 199 | + $orderBy = $this->service->getHost()->getQueryStringItem(ODataConstants::HTTPQUERY_STRING_ORDERBY); |
|
| 200 | 200 | |
| 201 | 201 | if (!is_null($orderBy)) { |
| 202 | 202 | $this->_checkSetQueryApplicable(); |
@@ -217,12 +217,12 @@ discard block |
||
| 217 | 217 | * RequestDescription::getTopCount will give non-null value. |
| 218 | 218 | * |
| 219 | 219 | */ |
| 220 | - if (!is_null($this->request->getSkipCount())|| !is_null($this->request->getTopCount())) { |
|
| 221 | - $orderBy = !is_null($orderBy) ? $orderBy . ', ' : null; |
|
| 220 | + if (!is_null($this->request->getSkipCount()) || !is_null($this->request->getTopCount())) { |
|
| 221 | + $orderBy = !is_null($orderBy) ? $orderBy.', ' : null; |
|
| 222 | 222 | $keys = array_keys($targetResourceType->getKeyProperties()); |
| 223 | 223 | //assert(!empty($keys)) |
| 224 | 224 | foreach ($keys as $key) { |
| 225 | - $orderBy = $orderBy . $key . ', '; |
|
| 225 | + $orderBy = $orderBy.$key.', '; |
|
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | $orderBy = rtrim($orderBy, ', '); |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | */ |
| 261 | 261 | private function _processFilter() |
| 262 | 262 | { |
| 263 | - $filter = $this->service->getHost()->getQueryStringItem( ODataConstants::HTTPQUERY_STRING_FILTER ); |
|
| 263 | + $filter = $this->service->getHost()->getQueryStringItem(ODataConstants::HTTPQUERY_STRING_FILTER); |
|
| 264 | 264 | if (is_null($filter)) { |
| 265 | 265 | return; |
| 266 | 266 | } |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | $kind = $this->request->getTargetKind(); |
| 269 | 269 | if (!($kind == TargetKind::RESOURCE() |
| 270 | 270 | || $kind == TargetKind::COMPLEX_OBJECT() |
| 271 | - || $this->request->queryType == QueryType::COUNT() ) |
|
| 271 | + || $this->request->queryType == QueryType::COUNT()) |
|
| 272 | 272 | ) { |
| 273 | 273 | throw ODataException::createBadRequestError( |
| 274 | 274 | Messages::queryProcessorQueryFilterOptionNotApplicable() |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | $resourceType = $this->request->getTargetResourceType(); |
| 278 | 278 | $expressionProvider = $this->service->getProvidersWrapper()->getExpressionProvider(); |
| 279 | 279 | $filterInfo = ExpressionParser2::parseExpression2($filter, $resourceType, $expressionProvider); |
| 280 | - $this->request->setFilterInfo( $filterInfo ); |
|
| 280 | + $this->request->setFilterInfo($filterInfo); |
|
| 281 | 281 | |
| 282 | 282 | } |
| 283 | 283 | |
@@ -294,10 +294,10 @@ discard block |
||
| 294 | 294 | */ |
| 295 | 295 | private function _processCount() |
| 296 | 296 | { |
| 297 | - $inlineCount = $this->service->getHost()->getQueryStringItem( ODataConstants::HTTPQUERY_STRING_INLINECOUNT ); |
|
| 297 | + $inlineCount = $this->service->getHost()->getQueryStringItem(ODataConstants::HTTPQUERY_STRING_INLINECOUNT); |
|
| 298 | 298 | |
| 299 | 299 | //If it's not specified, we're done |
| 300 | - if(is_null($inlineCount)) return; |
|
| 300 | + if (is_null($inlineCount)) return; |
|
| 301 | 301 | |
| 302 | 302 | //If the service doesn't allow count requests..then throw an exception |
| 303 | 303 | if (!$this->service->getConfiguration()->getAcceptCountRequests()) { |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | |
| 316 | 316 | //You can't specify $count & $inlinecount together |
| 317 | 317 | //TODO: ensure there's a test for this case see #55 |
| 318 | - if ($this->request->queryType == QueryType::COUNT() ) { |
|
| 318 | + if ($this->request->queryType == QueryType::COUNT()) { |
|
| 319 | 319 | throw ODataException::createBadRequestError( |
| 320 | 320 | Messages::queryProcessorInlineCountWithValueCount() |
| 321 | 321 | ); |
@@ -327,8 +327,8 @@ discard block |
||
| 327 | 327 | if ($inlineCount === ODataConstants::URI_ROWCOUNT_ALLOPTION) { |
| 328 | 328 | $this->request->queryType = QueryType::ENTITIES_WITH_COUNT(); |
| 329 | 329 | |
| 330 | - $this->request->raiseMinVersionRequirement( 2, 0 ); |
|
| 331 | - $this->request->raiseResponseVersion( 2, 0 ); |
|
| 330 | + $this->request->raiseMinVersionRequirement(2, 0); |
|
| 331 | + $this->request->raiseResponseVersion(2, 0); |
|
| 332 | 332 | |
| 333 | 333 | } else { |
| 334 | 334 | throw ODataException::createBadRequestError( |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | */ |
| 356 | 356 | private function _processSkipToken() |
| 357 | 357 | { |
| 358 | - $skipToken = $this->service->getHost()->getQueryStringItem( ODataConstants::HTTPQUERY_STRING_SKIPTOKEN ); |
|
| 358 | + $skipToken = $this->service->getHost()->getQueryStringItem(ODataConstants::HTTPQUERY_STRING_SKIPTOKEN); |
|
| 359 | 359 | if (is_null($skipToken)) { |
| 360 | 360 | return; |
| 361 | 361 | } |
@@ -383,8 +383,8 @@ discard block |
||
| 383 | 383 | $skipToken |
| 384 | 384 | ); |
| 385 | 385 | $this->request->setInternalSkipTokenInfo($internalSkipTokenInfo); |
| 386 | - $this->request->raiseMinVersionRequirement( 2, 0 ); |
|
| 387 | - $this->request->raiseResponseVersion( 2, 0 ); |
|
| 386 | + $this->request->raiseMinVersionRequirement(2, 0); |
|
| 387 | + $this->request->raiseResponseVersion(2, 0); |
|
| 388 | 388 | |
| 389 | 389 | |
| 390 | 390 | } |
@@ -402,26 +402,26 @@ discard block |
||
| 402 | 402 | */ |
| 403 | 403 | private function _processExpandAndSelect() |
| 404 | 404 | { |
| 405 | - $expand = $this->service->getHost()->getQueryStringItem( ODataConstants::HTTPQUERY_STRING_EXPAND ); |
|
| 405 | + $expand = $this->service->getHost()->getQueryStringItem(ODataConstants::HTTPQUERY_STRING_EXPAND); |
|
| 406 | 406 | |
| 407 | 407 | if (!is_null($expand)) { |
| 408 | - $this->_checkExpandOrSelectApplicable(ODataConstants::HTTPQUERY_STRING_EXPAND ); |
|
| 408 | + $this->_checkExpandOrSelectApplicable(ODataConstants::HTTPQUERY_STRING_EXPAND); |
|
| 409 | 409 | } |
| 410 | 410 | |
| 411 | - $select = $this->service->getHost()->getQueryStringItem( ODataConstants::HTTPQUERY_STRING_SELECT ); |
|
| 411 | + $select = $this->service->getHost()->getQueryStringItem(ODataConstants::HTTPQUERY_STRING_SELECT); |
|
| 412 | 412 | |
| 413 | 413 | if (!is_null($select)) { |
| 414 | 414 | if (!$this->service->getConfiguration()->getAcceptProjectionRequests()) { |
| 415 | - throw ODataException::createBadRequestError( Messages::configurationProjectionsNotAccepted() ); |
|
| 415 | + throw ODataException::createBadRequestError(Messages::configurationProjectionsNotAccepted()); |
|
| 416 | 416 | } |
| 417 | 417 | |
| 418 | - $this->_checkExpandOrSelectApplicable( ODataConstants::HTTPQUERY_STRING_SELECT ); |
|
| 418 | + $this->_checkExpandOrSelectApplicable(ODataConstants::HTTPQUERY_STRING_SELECT); |
|
| 419 | 419 | } |
| 420 | 420 | |
| 421 | 421 | // We will generate RootProjectionNode in case of $link request also, but |
| 422 | 422 | // expand and select in this case must be null (we are ensuring this above) |
| 423 | 423 | // 'RootProjectionNode' is required while generating next page Link |
| 424 | - if ($this->_expandSelectApplicable || $this->request->isLinkUri() ) { |
|
| 424 | + if ($this->_expandSelectApplicable || $this->request->isLinkUri()) { |
|
| 425 | 425 | |
| 426 | 426 | $rootProjectionNode = ExpandProjectionParser::parseExpandAndSelectClause( |
| 427 | 427 | $this->request->getTargetResourceSetWrapper(), |
@@ -434,13 +434,13 @@ discard block |
||
| 434 | 434 | $this->service->getProvidersWrapper() |
| 435 | 435 | ); |
| 436 | 436 | if ($rootProjectionNode->isSelectionSpecified()) { |
| 437 | - $this->request->raiseMinVersionRequirement(2, 0 ); |
|
| 437 | + $this->request->raiseMinVersionRequirement(2, 0); |
|
| 438 | 438 | } |
| 439 | 439 | |
| 440 | 440 | if ($rootProjectionNode->hasPagedExpandedResult()) { |
| 441 | - $this->request->raiseResponseVersion( 2, 0 ); |
|
| 441 | + $this->request->raiseResponseVersion(2, 0); |
|
| 442 | 442 | } |
| 443 | - $this->request->setRootProjectionNode($rootProjectionNode ); |
|
| 443 | + $this->request->setRootProjectionNode($rootProjectionNode); |
|
| 444 | 444 | |
| 445 | 445 | } |
| 446 | 446 | } |
@@ -297,7 +297,9 @@ |
||
| 297 | 297 | $inlineCount = $this->service->getHost()->getQueryStringItem( ODataConstants::HTTPQUERY_STRING_INLINECOUNT ); |
| 298 | 298 | |
| 299 | 299 | //If it's not specified, we're done |
| 300 | - if(is_null($inlineCount)) return; |
|
| 300 | + if(is_null($inlineCount)) { |
|
| 301 | + return; |
|
| 302 | + } |
|
| 301 | 303 | |
| 302 | 304 | //If the service doesn't allow count requests..then throw an exception |
| 303 | 305 | if (!$this->service->getConfiguration()->getAcceptCountRequests()) { |
@@ -2,8 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace POData\UriProcessor\QueryProcessor\SkipTokenParser; |
| 4 | 4 | |
| 5 | -use POData\Common\Messages; |
|
| 6 | -use POData\Providers\Metadata\ResourceType; |
|
| 7 | 5 | use POData\UriProcessor\QueryProcessor\OrderByParser\OrderByInfo; |
| 8 | 6 | |
| 9 | 7 | /** |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | * @param array(int,(array(string,IType))) $orderByValuesInSkipToken Collection of values in the skiptoken corrosponds |
| 41 | 41 | * to the orderby path segments. |
| 42 | 42 | */ |
| 43 | - public function __construct(OrderByInfo &$orderByInfo, $orderByValuesInSkipToken) |
|
| 43 | + public function __construct(OrderByInfo & $orderByInfo, $orderByValuesInSkipToken) |
|
| 44 | 44 | { |
| 45 | 45 | $this->_orderByInfo = $orderByInfo; |
| 46 | 46 | $this->_orderByValuesInSkipToken = $orderByValuesInSkipToken; |
@@ -7,7 +7,6 @@ |
||
| 7 | 7 | use POData\Providers\Metadata\Type\Null1; |
| 8 | 8 | use POData\Providers\Metadata\ResourceType; |
| 9 | 9 | use POData\UriProcessor\ResourcePathProcessor\SegmentParser\KeyDescriptor; |
| 10 | -use POData\UriProcessor\QueryProcessor\OrderByParser\OrderByInfo; |
|
| 11 | 10 | use POData\UriProcessor\QueryProcessor\OrderByParser\InternalOrderByInfo; |
| 12 | 11 | |
| 13 | 12 | /** |
@@ -66,7 +66,7 @@ |
||
| 66 | 66 | $orderByPathSegments = $internalOrderByInfo->getOrderByPathSegments(); |
| 67 | 67 | $orderByPathCount = count($orderByPathSegments); |
| 68 | 68 | if ($count != ($orderByPathCount)) { |
| 69 | - throw ODataException::createBadRequestError( |
|
| 69 | + throw ODataException::createBadRequestError( |
|
| 70 | 70 | Messages::skipTokenParserSkipTokenNotMatchingOrdering( |
| 71 | 71 | $count, $skipToken, $orderByPathCount |
| 72 | 72 | ) |
@@ -44,8 +44,8 @@ |
||
| 44 | 44 | * @throws ODataException |
| 45 | 45 | */ |
| 46 | 46 | public static function parseSkipTokenClause( |
| 47 | - ResourceType &$resourceType, |
|
| 48 | - InternalOrderByInfo &$internalOrderByInfo, |
|
| 47 | + ResourceType & $resourceType, |
|
| 48 | + InternalOrderByInfo & $internalOrderByInfo, |
|
| 49 | 49 | $skipToken |
| 50 | 50 | ) { |
| 51 | 51 | $tokenValueDescriptor = null; |
@@ -7,11 +7,9 @@ |
||
| 7 | 7 | use POData\Common\Messages; |
| 8 | 8 | use POData\Common\Version; |
| 9 | 9 | use POData\Common\ODataException; |
| 10 | -use POData\IService; |
|
| 11 | 10 | use POData\Providers\Metadata\ResourceProperty; |
| 12 | 11 | use POData\Providers\Metadata\ResourceSetWrapper; |
| 13 | 12 | use POData\Providers\Metadata\ResourceStreamInfo; |
| 14 | -use POData\UriProcessor\QueryProcessor\QueryProcessor; |
|
| 15 | 13 | use POData\UriProcessor\UriProcessor; |
| 16 | 14 | use POData\UriProcessor\ResourcePathProcessor\SegmentParser\TargetSource; |
| 17 | 15 | use POData\UriProcessor\ResourcePathProcessor\SegmentParser\TargetKind; |
@@ -75,8 +75,8 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | private $requiredMinRequestVersion; |
| 77 | 77 | |
| 78 | - /** @var Version */ |
|
| 79 | - private $maxServiceVersion; |
|
| 78 | + /** @var Version */ |
|
| 79 | + private $maxServiceVersion; |
|
| 80 | 80 | |
| 81 | 81 | /** |
| 82 | 82 | * Collection of known data service versions. |
@@ -114,12 +114,12 @@ discard block |
||
| 114 | 114 | private $_containerName; |
| 115 | 115 | |
| 116 | 116 | |
| 117 | - /** |
|
| 118 | - * The count option specified in the request. |
|
| 119 | - * |
|
| 120 | - * @var QueryType |
|
| 121 | - */ |
|
| 122 | - public $queryType; |
|
| 117 | + /** |
|
| 118 | + * The count option specified in the request. |
|
| 119 | + * |
|
| 120 | + * @var QueryType |
|
| 121 | + */ |
|
| 122 | + public $queryType; |
|
| 123 | 123 | |
| 124 | 124 | /** |
| 125 | 125 | * Number of segments. |
@@ -213,36 +213,36 @@ discard block |
||
| 213 | 213 | |
| 214 | 214 | |
| 215 | 215 | |
| 216 | - /** |
|
| 217 | - * @param SegmentDescriptor[] $segmentDescriptors Description of segments in the resource path. |
|
| 218 | - * @param Url $requestUri |
|
| 219 | - * @param Version $serviceMaxVersion |
|
| 220 | - * @param $requestVersion |
|
| 221 | - * @param $maxRequestVersion |
|
| 222 | - */ |
|
| 223 | - public function __construct($segmentDescriptors, Url $requestUri, Version $serviceMaxVersion, $requestVersion, $maxRequestVersion) |
|
| 216 | + /** |
|
| 217 | + * @param SegmentDescriptor[] $segmentDescriptors Description of segments in the resource path. |
|
| 218 | + * @param Url $requestUri |
|
| 219 | + * @param Version $serviceMaxVersion |
|
| 220 | + * @param $requestVersion |
|
| 221 | + * @param $maxRequestVersion |
|
| 222 | + */ |
|
| 223 | + public function __construct($segmentDescriptors, Url $requestUri, Version $serviceMaxVersion, $requestVersion, $maxRequestVersion) |
|
| 224 | 224 | { |
| 225 | 225 | $this->segments = $segmentDescriptors; |
| 226 | 226 | $this->_segmentCount = count($this->segments); |
| 227 | 227 | $this->requestUrl = $requestUri; |
| 228 | 228 | $this->lastSegment = $segmentDescriptors[$this->_segmentCount - 1]; |
| 229 | - $this->queryType = QueryType::ENTITIES(); |
|
| 229 | + $this->queryType = QueryType::ENTITIES(); |
|
| 230 | 230 | |
| 231 | 231 | //we use this for validation checks down in validateVersions...but maybe we should check that outside of this object... |
| 232 | 232 | $this->maxServiceVersion = $serviceMaxVersion; |
| 233 | 233 | |
| 234 | - //Per OData 1 & 2 spec we must return the smallest size |
|
| 235 | - //We start at 1.0 and move it up as features are requested |
|
| 234 | + //Per OData 1 & 2 spec we must return the smallest size |
|
| 235 | + //We start at 1.0 and move it up as features are requested |
|
| 236 | 236 | $this->requiredMinResponseVersion = clone Version::v1(); |
| 237 | 237 | $this->requiredMinRequestVersion = clone Version::v1(); |
| 238 | 238 | |
| 239 | 239 | |
| 240 | - //see http://www.odata.org/documentation/odata-v2-documentation/overview/#ProtocolVersioning |
|
| 241 | - //if requestVersion isn't there, use Service Max Version |
|
| 242 | - $this->requestVersion = is_null($requestVersion) ? $serviceMaxVersion : self::parseVersionHeader($requestVersion, ODataConstants::ODATAVERSIONHEADER); |
|
| 240 | + //see http://www.odata.org/documentation/odata-v2-documentation/overview/#ProtocolVersioning |
|
| 241 | + //if requestVersion isn't there, use Service Max Version |
|
| 242 | + $this->requestVersion = is_null($requestVersion) ? $serviceMaxVersion : self::parseVersionHeader($requestVersion, ODataConstants::ODATAVERSIONHEADER); |
|
| 243 | 243 | |
| 244 | - //if max version isn't there, use the request version |
|
| 245 | - $this->requestMaxVersion = is_null($maxRequestVersion) ? $this->requestVersion : self::parseVersionHeader($maxRequestVersion, ODataConstants::ODATAMAXVERSIONHEADER); |
|
| 244 | + //if max version isn't there, use the request version |
|
| 245 | + $this->requestMaxVersion = is_null($maxRequestVersion) ? $this->requestVersion : self::parseVersionHeader($maxRequestVersion, ODataConstants::ODATAMAXVERSIONHEADER); |
|
| 246 | 246 | |
| 247 | 247 | //if it's OData v3..things change a bit |
| 248 | 248 | if($this->maxServiceVersion == Version::v3()){ |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | public function raiseMinVersionRequirement($major, $minor) { |
| 285 | 285 | if($this->requiredMinRequestVersion->raiseVersion($major, $minor)) |
| 286 | 286 | { |
| 287 | - $this->validateVersions(); |
|
| 287 | + $this->validateVersions(); |
|
| 288 | 288 | } |
| 289 | 289 | } |
| 290 | 290 | |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | */ |
| 300 | 300 | public function raiseResponseVersion($major, $minor) { |
| 301 | 301 | if($this->requiredMinResponseVersion->raiseVersion($major, $minor)){ |
| 302 | - $this->validateVersions(); |
|
| 302 | + $this->validateVersions(); |
|
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | } |
@@ -810,7 +810,7 @@ discard block |
||
| 810 | 810 | public function getResponseVersion() |
| 811 | 811 | { |
| 812 | 812 | |
| 813 | - return $this->requiredMinResponseVersion; |
|
| 813 | + return $this->requiredMinResponseVersion; |
|
| 814 | 814 | } |
| 815 | 815 | |
| 816 | 816 | /** |
@@ -838,7 +838,7 @@ discard block |
||
| 838 | 838 | { |
| 839 | 839 | if (is_null(self::$_knownDataServiceVersions)) { |
| 840 | 840 | self::$_knownDataServiceVersions = array( |
| 841 | - new Version(1, 0), |
|
| 841 | + new Version(1, 0), |
|
| 842 | 842 | new Version(2, 0), |
| 843 | 843 | new Version(3, 0) |
| 844 | 844 | ); |
@@ -867,32 +867,32 @@ discard block |
||
| 867 | 867 | */ |
| 868 | 868 | public function validateVersions() { |
| 869 | 869 | |
| 870 | - //If the request version is below the minimum version required by supplied request arguments..throw an exception |
|
| 870 | + //If the request version is below the minimum version required by supplied request arguments..throw an exception |
|
| 871 | 871 | if ($this->requestVersion->compare($this->requiredMinRequestVersion) < 0) { |
| 872 | - throw ODataException::createBadRequestError( |
|
| 872 | + throw ODataException::createBadRequestError( |
|
| 873 | 873 | Messages::requestVersionTooLow( |
| 874 | - $this->requestVersion->toString(), |
|
| 875 | - $this->requiredMinRequestVersion->toString() |
|
| 874 | + $this->requestVersion->toString(), |
|
| 875 | + $this->requiredMinRequestVersion->toString() |
|
| 876 | 876 | ) |
| 877 | 877 | ); |
| 878 | 878 | } |
| 879 | 879 | |
| 880 | - //If the requested max version is below the version required to fulfill the response...throw an exception |
|
| 880 | + //If the requested max version is below the version required to fulfill the response...throw an exception |
|
| 881 | 881 | if ($this->requestMaxVersion->compare($this->requiredMinResponseVersion) < 0) { |
| 882 | - throw ODataException::createBadRequestError( |
|
| 882 | + throw ODataException::createBadRequestError( |
|
| 883 | 883 | Messages::requestVersionTooLow( |
| 884 | - $this->requestMaxVersion->toString(), |
|
| 885 | - $this->requiredMinResponseVersion->toString() |
|
| 884 | + $this->requestMaxVersion->toString(), |
|
| 885 | + $this->requiredMinResponseVersion->toString() |
|
| 886 | 886 | ) |
| 887 | 887 | ); |
| 888 | 888 | } |
| 889 | 889 | |
| 890 | 890 | //If the max version supported by the service is below the version required to fulfill the response..throw an exception |
| 891 | 891 | if ($this->maxServiceVersion->compare($this->requiredMinResponseVersion) < 0) { |
| 892 | - throw ODataException::createBadRequestError( |
|
| 892 | + throw ODataException::createBadRequestError( |
|
| 893 | 893 | Messages::requestVersionIsBiggerThanProtocolVersion( |
| 894 | - $this->requiredMinResponseVersion->toString(), |
|
| 895 | - $this->maxServiceVersion->toString() |
|
| 894 | + $this->requiredMinResponseVersion->toString(), |
|
| 895 | + $this->maxServiceVersion->toString() |
|
| 896 | 896 | ) |
| 897 | 897 | ); |
| 898 | 898 | } |
@@ -923,9 +923,9 @@ discard block |
||
| 923 | 923 | for ($i = 0; $i < $libNameIndex; $i++) { |
| 924 | 924 | if ($versionHeader[$i] == '.') { |
| 925 | 925 | |
| 926 | - //Throw an exception if we find more than 1 dot |
|
| 927 | - if ($dotIndex != -1) { |
|
| 928 | - throw ODataException::createBadRequestError( |
|
| 926 | + //Throw an exception if we find more than 1 dot |
|
| 927 | + if ($dotIndex != -1) { |
|
| 928 | + throw ODataException::createBadRequestError( |
|
| 929 | 929 | Messages::requestDescriptionInvalidVersionHeader( |
| 930 | 930 | $versionHeader, |
| 931 | 931 | $headerName |
@@ -935,7 +935,7 @@ discard block |
||
| 935 | 935 | |
| 936 | 936 | $dotIndex = $i; |
| 937 | 937 | } else if ($versionHeader[$i] < '0' || $versionHeader[$i] > '9') { |
| 938 | - throw ODataException::createBadRequestError( |
|
| 938 | + throw ODataException::createBadRequestError( |
|
| 939 | 939 | Messages::requestDescriptionInvalidVersionHeader( |
| 940 | 940 | $versionHeader, |
| 941 | 941 | $headerName |
@@ -945,14 +945,14 @@ discard block |
||
| 945 | 945 | } |
| 946 | 946 | |
| 947 | 947 | |
| 948 | - $major = intval(substr($versionHeader, 0, $dotIndex)); |
|
| 949 | - $minor = 0; |
|
| 948 | + $major = intval(substr($versionHeader, 0, $dotIndex)); |
|
| 949 | + $minor = 0; |
|
| 950 | 950 | |
| 951 | - //Apparently the . is optional |
|
| 951 | + //Apparently the . is optional |
|
| 952 | 952 | if ($dotIndex != -1) { |
| 953 | 953 | if ($dotIndex == 0) { |
| 954 | - //If it starts with a ., throw an exception |
|
| 955 | - throw ODataException::createBadRequestError( |
|
| 954 | + //If it starts with a ., throw an exception |
|
| 955 | + throw ODataException::createBadRequestError( |
|
| 956 | 956 | Messages::requestDescriptionInvalidVersionHeader( |
| 957 | 957 | $versionHeader, |
| 958 | 958 | $headerName |
@@ -965,8 +965,8 @@ discard block |
||
| 965 | 965 | |
| 966 | 966 | $version = new Version($major, $minor); |
| 967 | 967 | |
| 968 | - //TODO: move this somewhere... |
|
| 969 | - /* |
|
| 968 | + //TODO: move this somewhere... |
|
| 969 | + /* |
|
| 970 | 970 | $isSupportedVersion = false; |
| 971 | 971 | foreach (self::getKnownDataServiceVersions() as $version1) { |
| 972 | 972 | if ($version->compare($version1) == 0) { |
@@ -245,8 +245,8 @@ discard block |
||
| 245 | 245 | $this->requestMaxVersion = is_null($maxRequestVersion) ? $this->requestVersion : self::parseVersionHeader($maxRequestVersion, ODataConstants::ODATAMAXVERSIONHEADER); |
| 246 | 246 | |
| 247 | 247 | //if it's OData v3..things change a bit |
| 248 | - if($this->maxServiceVersion == Version::v3()){ |
|
| 249 | - if(is_null($maxRequestVersion)) |
|
| 248 | + if ($this->maxServiceVersion == Version::v3()) { |
|
| 249 | + if (is_null($maxRequestVersion)) |
|
| 250 | 250 | { |
| 251 | 251 | //if max request version isn't specified we use the service max version instead of the request version |
| 252 | 252 | //thus we favour newer versions |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | * @throws ODataException If capability negotiation fails. |
| 283 | 283 | */ |
| 284 | 284 | public function raiseMinVersionRequirement($major, $minor) { |
| 285 | - if($this->requiredMinRequestVersion->raiseVersion($major, $minor)) |
|
| 285 | + if ($this->requiredMinRequestVersion->raiseVersion($major, $minor)) |
|
| 286 | 286 | { |
| 287 | 287 | $this->validateVersions(); |
| 288 | 288 | } |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | * @throws ODataException If capability negotiation fails. |
| 299 | 299 | */ |
| 300 | 300 | public function raiseResponseVersion($major, $minor) { |
| 301 | - if($this->requiredMinResponseVersion->raiseVersion($major, $minor)){ |
|
| 301 | + if ($this->requiredMinResponseVersion->raiseVersion($major, $minor)) { |
|
| 302 | 302 | $this->validateVersions(); |
| 303 | 303 | } |
| 304 | 304 | |
@@ -623,7 +623,7 @@ discard block |
||
| 623 | 623 | * |
| 624 | 624 | * @return void |
| 625 | 625 | */ |
| 626 | - public function setInternalOrderByInfo(InternalOrderByInfo &$internalOrderByInfo) |
|
| 626 | + public function setInternalOrderByInfo(InternalOrderByInfo & $internalOrderByInfo) |
|
| 627 | 627 | { |
| 628 | 628 | $this->internalOrderByInfo = $internalOrderByInfo; |
| 629 | 629 | } |
@@ -647,7 +647,7 @@ discard block |
||
| 647 | 647 | * @return void |
| 648 | 648 | */ |
| 649 | 649 | public function setInternalSkipTokenInfo( |
| 650 | - InternalSkipTokenInfo &$internalSkipTokenInfo |
|
| 650 | + InternalSkipTokenInfo & $internalSkipTokenInfo |
|
| 651 | 651 | ) { |
| 652 | 652 | $this->_internalSkipTokenInfo = $internalSkipTokenInfo; |
| 653 | 653 | } |
@@ -679,9 +679,9 @@ discard block |
||
| 679 | 679 | * |
| 680 | 680 | * @return void |
| 681 | 681 | */ |
| 682 | - public function setRootProjectionNode(RootProjectionNode &$rootProjectionNode) |
|
| 682 | + public function setRootProjectionNode(RootProjectionNode & $rootProjectionNode) |
|
| 683 | 683 | { |
| 684 | - $this->_rootProjectionNode = $rootProjectionNode; |
|
| 684 | + $this->_rootProjectionNode = $rootProjectionNode; |
|
| 685 | 685 | } |
| 686 | 686 | |
| 687 | 687 | /** |
@@ -217,8 +217,8 @@ |
||
| 217 | 217 | * @param SegmentDescriptor[] $segmentDescriptors Description of segments in the resource path. |
| 218 | 218 | * @param Url $requestUri |
| 219 | 219 | * @param Version $serviceMaxVersion |
| 220 | - * @param $requestVersion |
|
| 221 | - * @param $maxRequestVersion |
|
| 220 | + * @param string|null $requestVersion |
|
| 221 | + * @param string|null $maxRequestVersion |
|
| 222 | 222 | */ |
| 223 | 223 | public function __construct($segmentDescriptors, Url $requestUri, Version $serviceMaxVersion, $requestVersion, $maxRequestVersion) |
| 224 | 224 | { |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | * KeyDescription. |
| 203 | 203 | * |
| 204 | 204 | * @param string $keyPredicate The predicate to parse |
| 205 | - * @param KeyDescriptor &$keyDescriptor On return, Description of key after |
|
| 205 | + * @param KeyDescriptor KeyDescriptor On return, Description of key after |
|
| 206 | 206 | * parsing |
| 207 | 207 | * |
| 208 | 208 | * @return boolean True if the given values were parsed; false if there was |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | * the type if valid this function provide the PHP value equivalent to |
| 455 | 455 | * the astoira URI key value |
| 456 | 456 | * |
| 457 | - * @param unknown $value The Astoria URI key value |
|
| 457 | + * @param string $value The Astoria URI key value |
|
| 458 | 458 | * @param ExpressionTokenId $tokenId The tokenId for $value literal |
| 459 | 459 | * @param unknown &$outValue After the invocation, this parameter |
| 460 | 460 | * holds the PHP value equivalent to $value, |
@@ -16,7 +16,6 @@ |
||
| 16 | 16 | use POData\Providers\Metadata\Type\Int32; |
| 17 | 17 | use POData\Providers\Metadata\Type\Null1; |
| 18 | 18 | use POData\UriProcessor\QueryProcessor\ExpressionParser\ExpressionTokenId; |
| 19 | -use POData\UriProcessor\QueryProcessor\ExpressionParser\ExpressionToken; |
|
| 20 | 19 | use POData\UriProcessor\QueryProcessor\ExpressionParser\ExpressionLexer; |
| 21 | 20 | use POData\Common\Messages; |
| 22 | 21 | |
@@ -175,7 +175,7 @@ |
||
| 175 | 175 | */ |
| 176 | 176 | public function isEmpty() |
| 177 | 177 | { |
| 178 | - return empty($this->_namedValues) |
|
| 178 | + return empty($this->_namedValues) |
|
| 179 | 179 | && empty($this->_positionalValues); |
| 180 | 180 | } |
| 181 | 181 | |
@@ -271,7 +271,7 @@ |
||
| 271 | 271 | if (!array_key_exists($keyName, $this->_namedValues)) { |
| 272 | 272 | $keysAsString = null; |
| 273 | 273 | foreach (array_keys($keyProperties) as $key) { |
| 274 | - $keysAsString .= $key . ', '; |
|
| 274 | + $keysAsString .= $key.', '; |
|
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | $keysAsString = rtrim($keysAsString, ' ,'); |
@@ -470,39 +470,39 @@ |
||
| 470 | 470 | private static function _getTypeAndValidateKeyValue($value, $tokenId, &$outValue, &$outType) |
| 471 | 471 | { |
| 472 | 472 | switch ($tokenId) { |
| 473 | - case ExpressionTokenId::BOOLEAN_LITERAL: |
|
| 474 | - $outType = new Boolean(); |
|
| 475 | - break; |
|
| 476 | - case ExpressionTokenId::DATETIME_LITERAL: |
|
| 477 | - $outType = new DateTime(); |
|
| 478 | - break; |
|
| 479 | - case ExpressionTokenId::GUID_LITERAL: |
|
| 480 | - $outType = new Guid(); |
|
| 481 | - break; |
|
| 482 | - case ExpressionTokenId::STRING_LITERAL: |
|
| 483 | - $outType = new StringType(); |
|
| 484 | - break; |
|
| 485 | - case ExpressionTokenId::INTEGER_LITERAL: |
|
| 486 | - $outType = new Int32(); |
|
| 487 | - break; |
|
| 488 | - case ExpressionTokenId::DECIMAL_LITERAL: |
|
| 489 | - $outType = new Decimal(); |
|
| 490 | - break; |
|
| 491 | - case ExpressionTokenId::DOUBLE_LITERAL: |
|
| 492 | - $outType = new Double(); |
|
| 493 | - break; |
|
| 494 | - case ExpressionTokenId::INT64_LITERAL: |
|
| 495 | - $outType = new Int64(); |
|
| 496 | - break; |
|
| 497 | - case ExpressionTokenId::SINGLE_LITERAL: |
|
| 498 | - $outType = new Single(); |
|
| 499 | - break; |
|
| 500 | - case ExpressionTokenId::NULL_LITERAL: |
|
| 501 | - $outType = new Null1(); |
|
| 502 | - break; |
|
| 503 | - default: |
|
| 504 | - $outType = null; |
|
| 505 | - return false; |
|
| 473 | + case ExpressionTokenId::BOOLEAN_LITERAL: |
|
| 474 | + $outType = new Boolean(); |
|
| 475 | + break; |
|
| 476 | + case ExpressionTokenId::DATETIME_LITERAL: |
|
| 477 | + $outType = new DateTime(); |
|
| 478 | + break; |
|
| 479 | + case ExpressionTokenId::GUID_LITERAL: |
|
| 480 | + $outType = new Guid(); |
|
| 481 | + break; |
|
| 482 | + case ExpressionTokenId::STRING_LITERAL: |
|
| 483 | + $outType = new StringType(); |
|
| 484 | + break; |
|
| 485 | + case ExpressionTokenId::INTEGER_LITERAL: |
|
| 486 | + $outType = new Int32(); |
|
| 487 | + break; |
|
| 488 | + case ExpressionTokenId::DECIMAL_LITERAL: |
|
| 489 | + $outType = new Decimal(); |
|
| 490 | + break; |
|
| 491 | + case ExpressionTokenId::DOUBLE_LITERAL: |
|
| 492 | + $outType = new Double(); |
|
| 493 | + break; |
|
| 494 | + case ExpressionTokenId::INT64_LITERAL: |
|
| 495 | + $outType = new Int64(); |
|
| 496 | + break; |
|
| 497 | + case ExpressionTokenId::SINGLE_LITERAL: |
|
| 498 | + $outType = new Single(); |
|
| 499 | + break; |
|
| 500 | + case ExpressionTokenId::NULL_LITERAL: |
|
| 501 | + $outType = new Null1(); |
|
| 502 | + break; |
|
| 503 | + default: |
|
| 504 | + $outType = null; |
|
| 505 | + return false; |
|
| 506 | 506 | } |
| 507 | 507 | |
| 508 | 508 | if (!$outType->validate($value, $outValue)) { |