@@ -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 | /** |
@@ -550,7 +550,7 @@ discard block |
||
| 550 | 550 | * @param ResourceType $resourceType The resource type to start looking |
| 551 | 551 | * @param ResourceProperty $resourceProperty The resource property in question |
| 552 | 552 | * |
| 553 | - * @return ResourceType|null Returns reference to the ResourceType on which |
|
| 553 | + * @return ResourceType Returns reference to the ResourceType on which |
|
| 554 | 554 | * the $resourceProperty is declared, NULL if |
| 555 | 555 | * $resourceProperty is not declared anywhere |
| 556 | 556 | * in the inheritance hierarchy |
@@ -605,6 +605,10 @@ discard block |
||
| 605 | 605 | } |
| 606 | 606 | |
| 607 | 607 | |
| 608 | + /** |
|
| 609 | + * @param QueryResult $queryResult |
|
| 610 | + * @param string $methodName |
|
| 611 | + */ |
|
| 608 | 612 | private function ValidateQueryResult($queryResult, QueryType $queryType, $methodName){ |
| 609 | 613 | if (!$queryResult instanceof QueryResult) { |
| 610 | 614 | throw ODataException::createInternalServerError( |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | $resourceSetWrappers = array(); |
| 178 | 178 | $resourceSetNames = array(); |
| 179 | 179 | foreach ($resourceSets as $resourceSet) { |
| 180 | - $name = $resourceSet->getName(); |
|
| 180 | + $name = $resourceSet->getName(); |
|
| 181 | 181 | if (in_array($name, $resourceSetNames)) { |
| 182 | 182 | throw new ODataException(Messages::providersWrapperEntitySetNameShouldBeUnique($name), 500 ); |
| 183 | 183 | } |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | public function resolveResourceSet($name) |
| 232 | 232 | { |
| 233 | 233 | if (array_key_exists($name, $this->setWrapperCache)) { |
| 234 | - return $this->setWrapperCache[$name]; |
|
| 234 | + return $this->setWrapperCache[$name]; |
|
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | $resourceSet = $this->metaProvider->resolveResourceSet($name); |
@@ -280,9 +280,9 @@ discard block |
||
| 280 | 280 | public function getDerivedTypes(ResourceType $resourceType) |
| 281 | 281 | { |
| 282 | 282 | $derivedTypes = $this->metaProvider->getDerivedTypes($resourceType); |
| 283 | - if (!is_array($derivedTypes)) { |
|
| 284 | - throw new InvalidOperationException(Messages::metadataAssociationTypeSetInvalidGetDerivedTypesReturnType($resourceType->getName())); |
|
| 285 | - } |
|
| 283 | + if (!is_array($derivedTypes)) { |
|
| 284 | + throw new InvalidOperationException(Messages::metadataAssociationTypeSetInvalidGetDerivedTypesReturnType($resourceType->getName())); |
|
| 285 | + } |
|
| 286 | 286 | |
| 287 | 287 | foreach ($derivedTypes as $derivedType) { |
| 288 | 288 | $this->_validateResourceType($derivedType); |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | * other end of the association is invisible |
| 327 | 327 | */ |
| 328 | 328 | public function getResourceAssociationSet( |
| 329 | - ResourceSet $set, |
|
| 329 | + ResourceSet $set, |
|
| 330 | 330 | ResourceType $type, |
| 331 | 331 | ResourceProperty $property |
| 332 | 332 | ) { |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | |
| 346 | 346 | if (!is_null($associationSet)) { |
| 347 | 347 | $thisAssociationSetEnd = $associationSet->getResourceAssociationSetEnd( |
| 348 | - $set, |
|
| 348 | + $set, |
|
| 349 | 349 | $type, |
| 350 | 350 | $property |
| 351 | 351 | ); |
@@ -438,26 +438,26 @@ discard block |
||
| 438 | 438 | */ |
| 439 | 439 | public function getResourceProperties(ResourceSetWrapper $setWrapper, ResourceType $resourceType) { |
| 440 | 440 | if ($resourceType->getResourceTypeKind() != ResourceTypeKind::ENTITY) { |
| 441 | - //Complex resource type |
|
| 442 | - return $resourceType->getAllProperties(); |
|
| 441 | + //Complex resource type |
|
| 442 | + return $resourceType->getAllProperties(); |
|
| 443 | 443 | } |
| 444 | - //TODO: move this to doctrine annotations |
|
| 445 | - $cacheKey = $setWrapper->getName() . '_' . $resourceType->getFullName(); |
|
| 444 | + //TODO: move this to doctrine annotations |
|
| 445 | + $cacheKey = $setWrapper->getName() . '_' . $resourceType->getFullName(); |
|
| 446 | 446 | if (!array_key_exists($cacheKey, $this->propertyCache)) { |
| 447 | - //Fill the cache |
|
| 448 | - $this->propertyCache[$cacheKey] = array(); |
|
| 449 | - foreach ($resourceType->getAllProperties() as $resourceProperty) { |
|
| 450 | - //Check whether this is a visible navigation property |
|
| 451 | - //TODO: is this broken?? see #87 |
|
| 452 | - if ($resourceProperty->getTypeKind() == ResourceTypeKind::ENTITY |
|
| 453 | - && !is_null($this->getResourceSetWrapperForNavigationProperty($setWrapper, $resourceType, $resourceProperty)) |
|
| 454 | - ) { |
|
| 455 | - $this->propertyCache[$cacheKey][$resourceProperty->getName()] = $resourceProperty; |
|
| 456 | - } else { |
|
| 457 | - //primitive, bag or complex property |
|
| 458 | - $this->propertyCache[$cacheKey][$resourceProperty->getName()] = $resourceProperty; |
|
| 459 | - } |
|
| 460 | - } |
|
| 447 | + //Fill the cache |
|
| 448 | + $this->propertyCache[$cacheKey] = array(); |
|
| 449 | + foreach ($resourceType->getAllProperties() as $resourceProperty) { |
|
| 450 | + //Check whether this is a visible navigation property |
|
| 451 | + //TODO: is this broken?? see #87 |
|
| 452 | + if ($resourceProperty->getTypeKind() == ResourceTypeKind::ENTITY |
|
| 453 | + && !is_null($this->getResourceSetWrapperForNavigationProperty($setWrapper, $resourceType, $resourceProperty)) |
|
| 454 | + ) { |
|
| 455 | + $this->propertyCache[$cacheKey][$resourceProperty->getName()] = $resourceProperty; |
|
| 456 | + } else { |
|
| 457 | + //primitive, bag or complex property |
|
| 458 | + $this->propertyCache[$cacheKey][$resourceProperty->getName()] = $resourceProperty; |
|
| 459 | + } |
|
| 460 | + } |
|
| 461 | 461 | } |
| 462 | 462 | return $this->propertyCache[$cacheKey]; |
| 463 | 463 | |
@@ -579,30 +579,30 @@ discard block |
||
| 579 | 579 | */ |
| 580 | 580 | public function getExpressionProvider() |
| 581 | 581 | { |
| 582 | - $expressionProvider = $this->queryProvider->getExpressionProvider(); |
|
| 582 | + $expressionProvider = $this->queryProvider->getExpressionProvider(); |
|
| 583 | 583 | if (is_null($expressionProvider)) { |
| 584 | 584 | throw ODataException::createInternalServerError(Messages::providersWrapperExpressionProviderMustNotBeNullOrEmpty()); |
| 585 | 585 | } |
| 586 | 586 | |
| 587 | 587 | if (!$expressionProvider instanceof IExpressionProvider) |
| 588 | 588 | { |
| 589 | - throw ODataException::createInternalServerError( Messages::providersWrapperInvalidExpressionProviderInstance() ); |
|
| 589 | + throw ODataException::createInternalServerError( Messages::providersWrapperInvalidExpressionProviderInstance() ); |
|
| 590 | 590 | } |
| 591 | 591 | |
| 592 | 592 | return $expressionProvider; |
| 593 | 593 | } |
| 594 | 594 | |
| 595 | - /** |
|
| 596 | - * Indicates if the QueryProvider can handle ordered paging, this means respecting order, skip, and top parameters |
|
| 597 | - * If the query provider can not handle ordered paging, it must return the entire result set and POData will |
|
| 598 | - * perform the ordering and paging |
|
| 599 | - * |
|
| 600 | - * @return Boolean True if the query provider can handle ordered paging, false if POData should perform the paging |
|
| 601 | - */ |
|
| 602 | - public function handlesOrderedPaging() |
|
| 603 | - { |
|
| 604 | - return $this->queryProvider->handlesOrderedPaging(); |
|
| 605 | - } |
|
| 595 | + /** |
|
| 596 | + * Indicates if the QueryProvider can handle ordered paging, this means respecting order, skip, and top parameters |
|
| 597 | + * If the query provider can not handle ordered paging, it must return the entire result set and POData will |
|
| 598 | + * perform the ordering and paging |
|
| 599 | + * |
|
| 600 | + * @return Boolean True if the query provider can handle ordered paging, false if POData should perform the paging |
|
| 601 | + */ |
|
| 602 | + public function handlesOrderedPaging() |
|
| 603 | + { |
|
| 604 | + return $this->queryProvider->handlesOrderedPaging(); |
|
| 605 | + } |
|
| 606 | 606 | |
| 607 | 607 | |
| 608 | 608 | private function ValidateQueryResult($queryResult, QueryType $queryType, $methodName){ |
@@ -650,14 +650,14 @@ discard block |
||
| 650 | 650 | public function getResourceSet(QueryType $queryType, ResourceSet $resourceSet, $filterInfo, $orderBy, $top, $skip) |
| 651 | 651 | { |
| 652 | 652 | |
| 653 | - $queryResult = $this->queryProvider->getResourceSet( |
|
| 654 | - $queryType, |
|
| 655 | - $resourceSet, |
|
| 656 | - $filterInfo, |
|
| 657 | - $orderBy, |
|
| 658 | - $top, |
|
| 659 | - $skip |
|
| 660 | - ); |
|
| 653 | + $queryResult = $this->queryProvider->getResourceSet( |
|
| 654 | + $queryType, |
|
| 655 | + $resourceSet, |
|
| 656 | + $filterInfo, |
|
| 657 | + $orderBy, |
|
| 658 | + $top, |
|
| 659 | + $skip |
|
| 660 | + ); |
|
| 661 | 661 | |
| 662 | 662 | $this->validateQueryResult($queryResult, $queryType, 'IQueryProvider::getResourceSet'); |
| 663 | 663 | |
@@ -703,10 +703,10 @@ discard block |
||
| 703 | 703 | * |
| 704 | 704 | * @throws ODataException |
| 705 | 705 | */ |
| 706 | - public function getRelatedResourceSet( |
|
| 707 | - QueryType $queryType, |
|
| 708 | - ResourceSet $sourceResourceSet, |
|
| 709 | - $sourceEntity, |
|
| 706 | + public function getRelatedResourceSet( |
|
| 707 | + QueryType $queryType, |
|
| 708 | + ResourceSet $sourceResourceSet, |
|
| 709 | + $sourceEntity, |
|
| 710 | 710 | ResourceSet $targetResourceSet, |
| 711 | 711 | ResourceProperty $targetProperty, |
| 712 | 712 | $filterInfo, |
@@ -715,17 +715,17 @@ discard block |
||
| 715 | 715 | $skip |
| 716 | 716 | ) { |
| 717 | 717 | |
| 718 | - $queryResult = $this->queryProvider->getRelatedResourceSet( |
|
| 719 | - $queryType, |
|
| 720 | - $sourceResourceSet, |
|
| 721 | - $sourceEntity, |
|
| 722 | - $targetResourceSet, |
|
| 723 | - $targetProperty, |
|
| 724 | - $filterInfo, |
|
| 725 | - $orderBy, |
|
| 726 | - $top, |
|
| 727 | - $skip |
|
| 728 | - ); |
|
| 718 | + $queryResult = $this->queryProvider->getRelatedResourceSet( |
|
| 719 | + $queryType, |
|
| 720 | + $sourceResourceSet, |
|
| 721 | + $sourceEntity, |
|
| 722 | + $targetResourceSet, |
|
| 723 | + $targetProperty, |
|
| 724 | + $filterInfo, |
|
| 725 | + $orderBy, |
|
| 726 | + $top, |
|
| 727 | + $skip |
|
| 728 | + ); |
|
| 729 | 729 | |
| 730 | 730 | |
| 731 | 731 | $this->validateQueryResult($queryResult, $queryType, 'IQueryProvider::getRelatedResourceSet'); |
@@ -751,14 +751,14 @@ discard block |
||
| 751 | 751 | KeyDescriptor $keyDescriptor |
| 752 | 752 | ) { |
| 753 | 753 | $entityInstance = $this->queryProvider->getResourceFromRelatedResourceSet( |
| 754 | - $sourceResourceSet, |
|
| 755 | - $sourceEntity, |
|
| 756 | - $targetResourceSet, |
|
| 757 | - $targetProperty, |
|
| 758 | - $keyDescriptor |
|
| 759 | - ); |
|
| 760 | - |
|
| 761 | - $this->_validateEntityInstance( |
|
| 754 | + $sourceResourceSet, |
|
| 755 | + $sourceEntity, |
|
| 756 | + $targetResourceSet, |
|
| 757 | + $targetProperty, |
|
| 758 | + $keyDescriptor |
|
| 759 | + ); |
|
| 760 | + |
|
| 761 | + $this->_validateEntityInstance( |
|
| 762 | 762 | $entityInstance, $targetResourceSet, |
| 763 | 763 | $keyDescriptor, |
| 764 | 764 | 'IQueryProvider::getResourceFromRelatedResourceSet' |
@@ -913,8 +913,8 @@ discard block |
||
| 913 | 913 | */ |
| 914 | 914 | protected function assert($condition, $conditionAsString) |
| 915 | 915 | { |
| 916 | - if (!$condition) { |
|
| 917 | - throw new InvalidOperationException("Unexpected state, expecting $conditionAsString"); |
|
| 918 | - } |
|
| 916 | + if (!$condition) { |
|
| 917 | + throw new InvalidOperationException("Unexpected state, expecting $conditionAsString"); |
|
| 918 | + } |
|
| 919 | 919 | } |
| 920 | 920 | } |
| 921 | 921 | \ No newline at end of file |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | foreach ($resourceSets as $resourceSet) { |
| 180 | 180 | $name = $resourceSet->getName(); |
| 181 | 181 | if (in_array($name, $resourceSetNames)) { |
| 182 | - throw new ODataException(Messages::providersWrapperEntitySetNameShouldBeUnique($name), 500 ); |
|
| 182 | + throw new ODataException(Messages::providersWrapperEntitySetNameShouldBeUnique($name), 500); |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | $resourceSetNames[] = $name; |
@@ -331,9 +331,9 @@ discard block |
||
| 331 | 331 | ResourceProperty $property |
| 332 | 332 | ) { |
| 333 | 333 | $type = $this->_getResourceTypeWherePropertyIsDeclared($type, $property); |
| 334 | - $cacheKey = $set->getName() . '_' . $type->getName() . '_' . $property->getName(); |
|
| 334 | + $cacheKey = $set->getName().'_'.$type->getName().'_'.$property->getName(); |
|
| 335 | 335 | |
| 336 | - if (array_key_exists($cacheKey, $this->associationSetCache)) { |
|
| 336 | + if (array_key_exists($cacheKey, $this->associationSetCache)) { |
|
| 337 | 337 | return $this->associationSetCache[$cacheKey]; |
| 338 | 338 | } |
| 339 | 339 | |
@@ -442,8 +442,8 @@ discard block |
||
| 442 | 442 | return $resourceType->getAllProperties(); |
| 443 | 443 | } |
| 444 | 444 | //TODO: move this to doctrine annotations |
| 445 | - $cacheKey = $setWrapper->getName() . '_' . $resourceType->getFullName(); |
|
| 446 | - if (!array_key_exists($cacheKey, $this->propertyCache)) { |
|
| 445 | + $cacheKey = $setWrapper->getName().'_'.$resourceType->getFullName(); |
|
| 446 | + if (!array_key_exists($cacheKey, $this->propertyCache)) { |
|
| 447 | 447 | //Fill the cache |
| 448 | 448 | $this->propertyCache[$cacheKey] = array(); |
| 449 | 449 | foreach ($resourceType->getAllProperties() as $resourceProperty) { |
@@ -586,7 +586,7 @@ discard block |
||
| 586 | 586 | |
| 587 | 587 | if (!$expressionProvider instanceof IExpressionProvider) |
| 588 | 588 | { |
| 589 | - throw ODataException::createInternalServerError( Messages::providersWrapperInvalidExpressionProviderInstance() ); |
|
| 589 | + throw ODataException::createInternalServerError(Messages::providersWrapperInvalidExpressionProviderInstance()); |
|
| 590 | 590 | } |
| 591 | 591 | |
| 592 | 592 | return $expressionProvider; |
@@ -605,30 +605,30 @@ discard block |
||
| 605 | 605 | } |
| 606 | 606 | |
| 607 | 607 | |
| 608 | - private function ValidateQueryResult($queryResult, QueryType $queryType, $methodName){ |
|
| 608 | + private function ValidateQueryResult($queryResult, QueryType $queryType, $methodName) { |
|
| 609 | 609 | if (!$queryResult instanceof QueryResult) { |
| 610 | 610 | throw ODataException::createInternalServerError( |
| 611 | 611 | Messages::queryProviderReturnsNonQueryResult($methodName) |
| 612 | 612 | ); |
| 613 | 613 | } |
| 614 | 614 | |
| 615 | - if($queryType == QueryType::COUNT() || $queryType == QueryType::ENTITIES_WITH_COUNT()){ |
|
| 615 | + if ($queryType == QueryType::COUNT() || $queryType == QueryType::ENTITIES_WITH_COUNT()) { |
|
| 616 | 616 | //and the provider is supposed to handle the ordered paging they must return a count! |
| 617 | - if($this->queryProvider->handlesOrderedPaging() && !is_numeric($queryResult->count)){ |
|
| 617 | + if ($this->queryProvider->handlesOrderedPaging() && !is_numeric($queryResult->count)) { |
|
| 618 | 618 | throw ODataException::createInternalServerError( |
| 619 | 619 | Messages::queryProviderResultCountMissing($methodName, $queryType) |
| 620 | 620 | ); |
| 621 | 621 | } |
| 622 | 622 | |
| 623 | 623 | //If POData is supposed to handle the ordered aging they must return results! (possibly empty) |
| 624 | - if(!$this->queryProvider->handlesOrderedPaging() && !is_array($queryResult->results)){ |
|
| 624 | + if (!$this->queryProvider->handlesOrderedPaging() && !is_array($queryResult->results)) { |
|
| 625 | 625 | throw ODataException::createInternalServerError( |
| 626 | 626 | Messages::queryProviderResultsMissing($methodName, $queryType) |
| 627 | 627 | ); |
| 628 | 628 | } |
| 629 | 629 | } |
| 630 | 630 | |
| 631 | - if(($queryType == QueryType::ENTITIES() || $queryType == QueryType::ENTITIES_WITH_COUNT()) && !is_array($queryResult->results)){ |
|
| 631 | + if (($queryType == QueryType::ENTITIES() || $queryType == QueryType::ENTITIES_WITH_COUNT()) && !is_array($queryResult->results)) { |
|
| 632 | 632 | throw ODataException::createInternalServerError( |
| 633 | 633 | Messages::queryProviderResultsMissing($methodName, $queryType) |
| 634 | 634 | ); |
@@ -676,7 +676,7 @@ discard block |
||
| 676 | 676 | */ |
| 677 | 677 | public function getResourceFromResourceSet(ResourceSet $resourceSet, KeyDescriptor $keyDescriptor) |
| 678 | 678 | { |
| 679 | - $entityInstance = $this->queryProvider->getResourceFromResourceSet( $resourceSet, $keyDescriptor ); |
|
| 679 | + $entityInstance = $this->queryProvider->getResourceFromResourceSet($resourceSet, $keyDescriptor); |
|
| 680 | 680 | $this->_validateEntityInstance( |
| 681 | 681 | $entityInstance, |
| 682 | 682 | $resourceSet, |
@@ -852,8 +852,8 @@ discard block |
||
| 852 | 852 | * @throws ODataException |
| 853 | 853 | */ |
| 854 | 854 | private function _validateEntityInstance($entityInstance, |
| 855 | - ResourceSet &$resourceSet, |
|
| 856 | - KeyDescriptor &$keyDescriptor, |
|
| 855 | + ResourceSet & $resourceSet, |
|
| 856 | + KeyDescriptor & $keyDescriptor, |
|
| 857 | 857 | $methodName |
| 858 | 858 | ) { |
| 859 | 859 | if (is_null($entityInstance)) { |
@@ -281,7 +281,7 @@ |
||
| 281 | 281 | * Gets the sort information associated with the expanded navigation |
| 282 | 282 | * property or root of 'Projection Tree'. |
| 283 | 283 | * |
| 284 | - * @return InternalOrderByInfo|null |
|
| 284 | + * @return InternalOrderByInfo |
|
| 285 | 285 | */ |
| 286 | 286 | public function getInternalOrderByInfo() |
| 287 | 287 | { |
@@ -413,7 +413,7 @@ |
||
| 413 | 413 | $this->_selectAllImmediateProperties = false; |
| 414 | 414 | foreach ($this->_childNodes as $node) { |
| 415 | 415 | if ($node instanceof ExpandedProjectionNode) { |
| 416 | - $node->markSubtreeAsSelected(); |
|
| 416 | + $node->markSubtreeAsSelected(); |
|
| 417 | 417 | } |
| 418 | 418 | } |
| 419 | 419 | } |
@@ -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 | |
@@ -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 String()); |
|
| 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 String()); |
|
| 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 | |
@@ -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 | |
@@ -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 | { |