@@ -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 | { |
@@ -16,9 +16,9 @@ |
||
| 16 | 16 | /** |
| 17 | 17 | * Construct a new instance of UnaryExpression |
| 18 | 18 | * |
| 19 | - * @param unknown_type $child Child expression |
|
| 19 | + * @param AbstractExpression $child Child expression |
|
| 20 | 20 | * @param unknown_type $nodeType Expression node type |
| 21 | - * @param unknown_type $type Expression type |
|
| 21 | + * @param \POData\Providers\Metadata\Type\IType $type Expression type |
|
| 22 | 22 | */ |
| 23 | 23 | public function __construct($child, $nodeType, $type) |
| 24 | 24 | { |
@@ -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 | { |
@@ -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\String; |
| 19 | 18 | use POData\Providers\Metadata\Type\Boolean; |
| 20 | -use POData\Providers\Metadata\Type\Void; |
|
| 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 | |
@@ -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( |
@@ -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,10 +2,7 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace POData\UriProcessor\QueryProcessor\SkipTokenParser; |
| 4 | 4 | |
| 5 | -use POData\Providers\Metadata\Type\Guid; |
|
| 6 | 5 | use POData\Providers\Metadata\Type\Null1; |
| 7 | -use POData\Providers\Metadata\Type\DateTime; |
|
| 8 | -use POData\Providers\Metadata\Type\String; |
|
| 9 | 6 | use POData\Providers\Metadata\ResourceType; |
| 10 | 7 | use POData\UriProcessor\QueryProcessor\OrderByParser\InternalOrderByInfo; |
| 11 | 8 | use POData\Common\Messages; |
@@ -72,8 +72,8 @@ discard block |
||
| 72 | 72 | * orderby path segments. |
| 73 | 73 | * @param ResourceType &$resourceType Reference to the type of the resource pointed by the request uri. |
| 74 | 74 | */ |
| 75 | - public function __construct(InternalOrderByInfo &$internalOrderByInfo, |
|
| 76 | - $orderByValuesInSkipToken, ResourceType &$resourceType |
|
| 75 | + public function __construct(InternalOrderByInfo & $internalOrderByInfo, |
|
| 76 | + $orderByValuesInSkipToken, ResourceType & $resourceType |
|
| 77 | 77 | ) { |
| 78 | 78 | $this->_internalOrderByInfo = $internalOrderByInfo; |
| 79 | 79 | $this->_orderByValuesInSkipToken = $orderByValuesInSkipToken; |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | } else if ($isLastSegment) { |
| 283 | 283 | $type = $subPathSegment->getInstanceType(); |
| 284 | 284 | $value = $type->convertToOData($currentObject); |
| 285 | - $nextPageLink .= $value . ', '; |
|
| 285 | + $nextPageLink .= $value.', '; |
|
| 286 | 286 | } |
| 287 | 287 | } catch (\ReflectionException $reflectionException) { |
| 288 | 288 | throw ODataException::createInternalServerError( |
@@ -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; |