@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | /** |
| 108 | 108 | * Write a top level entry resource. |
| 109 | 109 | * |
| 110 | - * @param mixed $entryObject Reference to the entry object to be written |
|
| 110 | + * @param QueryResult $entryObject Reference to the entry object to be written |
|
| 111 | 111 | * |
| 112 | 112 | * @return ODataEntry |
| 113 | 113 | */ |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | /** |
| 258 | 258 | * Write top level url element. |
| 259 | 259 | * |
| 260 | - * @param mixed $entryObject The entry resource whose url to be written |
|
| 260 | + * @param QueryResult $entryObject The entry resource whose url to be written |
|
| 261 | 261 | * |
| 262 | 262 | * @return ODataURL |
| 263 | 263 | */ |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | /** |
| 282 | 282 | * Write top level url collection. |
| 283 | 283 | * |
| 284 | - * @param array $entryObjects Array of entry resources |
|
| 284 | + * @param QueryResult $entryObjects Array of entry resources |
|
| 285 | 285 | * whose url to be written |
| 286 | 286 | * |
| 287 | 287 | * @return ODataURLCollection |
@@ -441,6 +441,9 @@ discard block |
||
| 441 | 441 | return $this->stack; |
| 442 | 442 | } |
| 443 | 443 | |
| 444 | + /** |
|
| 445 | + * @param string $containerName |
|
| 446 | + */ |
|
| 444 | 447 | protected function getEntryInstanceKey($entityInstance, ResourceType $resourceType, $containerName) |
| 445 | 448 | { |
| 446 | 449 | $typeName = $resourceType->getName(); |
@@ -472,7 +475,7 @@ discard block |
||
| 472 | 475 | /** |
| 473 | 476 | * @param $entryObject |
| 474 | 477 | * @param $type |
| 475 | - * @param $relativeUri |
|
| 478 | + * @param string $relativeUri |
|
| 476 | 479 | * @param $resourceType |
| 477 | 480 | * @return array |
| 478 | 481 | */ |
@@ -539,7 +542,7 @@ discard block |
||
| 539 | 542 | * Find a 'ExpandedProjectionNode' instance in the projection tree |
| 540 | 543 | * which describes the current segment. |
| 541 | 544 | * |
| 542 | - * @return ExpandedProjectionNode|null |
|
| 545 | + * @return null|\POData\UriProcessor\QueryProcessor\ExpandProjectionParser\RootProjectionNode|ExpandedProjectionNode |
|
| 543 | 546 | */ |
| 544 | 547 | protected function getCurrentExpandedProjectionNode() |
| 545 | 548 | { |
@@ -764,7 +767,7 @@ discard block |
||
| 764 | 767 | /** |
| 765 | 768 | * @param $entryObject |
| 766 | 769 | * @param $prop |
| 767 | - * @param $nuLink |
|
| 770 | + * @param ODataLink $nuLink |
|
| 768 | 771 | * @param $propKind |
| 769 | 772 | * @param $propName |
| 770 | 773 | */ |
@@ -875,6 +878,9 @@ discard block |
||
| 875 | 878 | return $internalContent; |
| 876 | 879 | } |
| 877 | 880 | |
| 881 | + /** |
|
| 882 | + * @param ResourcePropertyKind $resourceKind |
|
| 883 | + */ |
|
| 878 | 884 | public static function isMatchPrimitive($resourceKind) |
| 879 | 885 | { |
| 880 | 886 | if (16 > $resourceKind) { |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | $this->service = $service; |
| 100 | 100 | $this->request = $request; |
| 101 | 101 | $this->absoluteServiceUri = $service->getHost()->getAbsoluteServiceUri()->getUrlAsString(); |
| 102 | - $this->absoluteServiceUriWithSlash = rtrim($this->absoluteServiceUri, '/') . '/'; |
|
| 102 | + $this->absoluteServiceUriWithSlash = rtrim($this->absoluteServiceUri, '/').'/'; |
|
| 103 | 103 | $this->stack = new SegmentStack($request); |
| 104 | 104 | $this->complexTypeInstanceCollection = []; |
| 105 | 105 | $this->modelSerialiser = new ModelSerialiser(); |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | $resourceType, |
| 146 | 146 | $resourceSet->getName() |
| 147 | 147 | ); |
| 148 | - $absoluteUri = rtrim($this->absoluteServiceUri, '/') . '/' . $relativeUri; |
|
| 148 | + $absoluteUri = rtrim($this->absoluteServiceUri, '/').'/'.$relativeUri; |
|
| 149 | 149 | |
| 150 | 150 | list($mediaLink, $mediaLinks) = $this->writeMediaData($entryObject->results, $type, $relativeUri, $resourceType); |
| 151 | 151 | |
@@ -166,8 +166,8 @@ discard block |
||
| 166 | 166 | $propType = 'application/atom+xml;type='.$propTail; |
| 167 | 167 | $propName = $prop->getName(); |
| 168 | 168 | $nuLink->title = $propName; |
| 169 | - $nuLink->name = ODataConstants::ODATA_RELATED_NAMESPACE . $propName; |
|
| 170 | - $nuLink->url = $relativeUri . '/' . $propName; |
|
| 169 | + $nuLink->name = ODataConstants::ODATA_RELATED_NAMESPACE.$propName; |
|
| 170 | + $nuLink->url = $relativeUri.'/'.$propName; |
|
| 171 | 171 | $nuLink->type = $propType; |
| 172 | 172 | |
| 173 | 173 | $navProp = new ODataNavigationPropertyInfo($prop, $this->shouldExpandSegment($propName)); |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | * |
| 204 | 204 | * @return ODataFeed |
| 205 | 205 | */ |
| 206 | - public function writeTopLevelElements(QueryResult &$entryObjects) |
|
| 206 | + public function writeTopLevelElements(QueryResult & $entryObjects) |
|
| 207 | 207 | { |
| 208 | 208 | assert(is_array($entryObjects->results), '!is_array($entryObjects->results)'); |
| 209 | 209 | |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | $resourceSet = $this->getRequest()->getTargetResourceSetWrapper()->getResourceSet(); |
| 241 | 241 | $requestTop = $this->getRequest()->getTopOptionCount(); |
| 242 | 242 | $pageSize = $this->getService()->getConfiguration()->getEntitySetPageSize($resourceSet); |
| 243 | - $requestTop = (null == $requestTop) ? $pageSize + 1 : $requestTop; |
|
| 243 | + $requestTop = (null == $requestTop) ? $pageSize+1 : $requestTop; |
|
| 244 | 244 | |
| 245 | 245 | if (true === $entryObjects->hasMore && $requestTop > $pageSize) { |
| 246 | 246 | $stackSegment = $setName; |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | $segment = $this->getNextLinkUri($lastObject, $absoluteUri); |
| 249 | 249 | $nextLink = new ODataLink(); |
| 250 | 250 | $nextLink->name = ODataConstants::ATOM_LINK_NEXT_ATTRIBUTE_STRING; |
| 251 | - $nextLink->url = rtrim($this->absoluteServiceUri, '/') . '/' . $stackSegment . $segment; |
|
| 251 | + $nextLink->url = rtrim($this->absoluteServiceUri, '/').'/'.$stackSegment.$segment; |
|
| 252 | 252 | $odata->nextPageLink = $nextLink; |
| 253 | 253 | } |
| 254 | 254 | |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | $this->getCurrentResourceSetWrapper()->getName() |
| 274 | 274 | ); |
| 275 | 275 | |
| 276 | - $url->url = rtrim($this->absoluteServiceUri, '/') . '/' . $relativeUri; |
|
| 276 | + $url->url = rtrim($this->absoluteServiceUri, '/').'/'.$relativeUri; |
|
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | return $url; |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | $segment = $this->getNextLinkUri($lastObject, $this->getRequest()->getRequestUrl()->getUrlAsString()); |
| 304 | 304 | $nextLink = new ODataLink(); |
| 305 | 305 | $nextLink->name = ODataConstants::ATOM_LINK_NEXT_ATTRIBUTE_STRING; |
| 306 | - $nextLink->url = rtrim($this->absoluteServiceUri, '/') . '/' . $stackSegment . $segment; |
|
| 306 | + $nextLink->url = rtrim($this->absoluteServiceUri, '/').'/'.$stackSegment.$segment; |
|
| 307 | 307 | $urls->nextPageLink = $nextLink; |
| 308 | 308 | } |
| 309 | 309 | } |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | * |
| 328 | 328 | * @return ODataPropertyContent |
| 329 | 329 | */ |
| 330 | - public function writeTopLevelComplexObject(QueryResult &$complexValue, $propertyName, ResourceType &$resourceType) |
|
| 330 | + public function writeTopLevelComplexObject(QueryResult & $complexValue, $propertyName, ResourceType & $resourceType) |
|
| 331 | 331 | { |
| 332 | 332 | $result = $complexValue->results; |
| 333 | 333 | |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | * bag object |
| 357 | 357 | * @return ODataPropertyContent |
| 358 | 358 | */ |
| 359 | - public function writeTopLevelBagObject(QueryResult &$BagValue, $propertyName, ResourceType &$resourceType) |
|
| 359 | + public function writeTopLevelBagObject(QueryResult & $BagValue, $propertyName, ResourceType & $resourceType) |
|
| 360 | 360 | { |
| 361 | 361 | $result = $BagValue->results; |
| 362 | 362 | |
@@ -379,7 +379,7 @@ discard block |
||
| 379 | 379 | * primitive property to be written |
| 380 | 380 | * @return ODataPropertyContent |
| 381 | 381 | */ |
| 382 | - public function writeTopLevelPrimitive(QueryResult &$primitiveValue, ResourceProperty &$resourceProperty = null) |
|
| 382 | + public function writeTopLevelPrimitive(QueryResult & $primitiveValue, ResourceProperty & $resourceProperty = null) |
|
| 383 | 383 | { |
| 384 | 384 | assert(null != $resourceProperty, "Resource property must not be null"); |
| 385 | 385 | $propertyContent = new ODataPropertyContent(); |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | $typeName = $resourceType->getName(); |
| 448 | 448 | $keyProperties = $resourceType->getKeyProperties(); |
| 449 | 449 | assert(count($keyProperties) != 0, 'count($keyProperties) == 0'); |
| 450 | - $keyString = $containerName . '('; |
|
| 450 | + $keyString = $containerName.'('; |
|
| 451 | 451 | $comma = null; |
| 452 | 452 | foreach ($keyProperties as $keyName => $resourceProperty) { |
| 453 | 453 | $keyType = $resourceProperty->getInstanceType(); |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | } |
| 462 | 462 | |
| 463 | 463 | $keyValue = $keyType->convertToOData($keyValue); |
| 464 | - $keyString .= $comma . $keyName . '=' . $keyValue; |
|
| 464 | + $keyString .= $comma.$keyName.'='.$keyValue; |
|
| 465 | 465 | $comma = ','; |
| 466 | 466 | } |
| 467 | 467 | |
@@ -486,7 +486,7 @@ discard block |
||
| 486 | 486 | $mediaLink = null; |
| 487 | 487 | if ($resourceType->isMediaLinkEntry()) { |
| 488 | 488 | $eTag = $streamProviderWrapper->getStreamETag2($entryObject, null, $context); |
| 489 | - $mediaLink = new ODataMediaLink($type, '/$value', $relativeUri . '/$value', '*/*', $eTag); |
|
| 489 | + $mediaLink = new ODataMediaLink($type, '/$value', $relativeUri.'/$value', '*/*', $eTag); |
|
| 490 | 490 | } |
| 491 | 491 | $mediaLinks = []; |
| 492 | 492 | if ($resourceType->hasNamedStream()) { |
@@ -627,7 +627,7 @@ discard block |
||
| 627 | 627 | $segmentWrappers = $this->getStack()->getSegmentWrappers(); |
| 628 | 628 | $count = count($segmentWrappers); |
| 629 | 629 | |
| 630 | - return 0 == $count ? $this->getRequest()->getTargetResourceSetWrapper() : $segmentWrappers[$count - 1]; |
|
| 630 | + return 0 == $count ? $this->getRequest()->getTargetResourceSetWrapper() : $segmentWrappers[$count-1]; |
|
| 631 | 631 | } |
| 632 | 632 | |
| 633 | 633 | /** |
@@ -677,22 +677,22 @@ discard block |
||
| 677 | 677 | $value = $this->getService()->getHost()->getQueryStringItem($queryOption); |
| 678 | 678 | if (!is_null($value)) { |
| 679 | 679 | if (!is_null($queryParameterString)) { |
| 680 | - $queryParameterString = $queryParameterString . '&'; |
|
| 680 | + $queryParameterString = $queryParameterString.'&'; |
|
| 681 | 681 | } |
| 682 | 682 | |
| 683 | - $queryParameterString .= $queryOption . '=' . $value; |
|
| 683 | + $queryParameterString .= $queryOption.'='.$value; |
|
| 684 | 684 | } |
| 685 | 685 | } |
| 686 | 686 | |
| 687 | 687 | $topCountValue = $this->getRequest()->getTopOptionCount(); |
| 688 | 688 | if (!is_null($topCountValue)) { |
| 689 | - $remainingCount = $topCountValue - $this->getRequest()->getTopCount(); |
|
| 689 | + $remainingCount = $topCountValue-$this->getRequest()->getTopCount(); |
|
| 690 | 690 | if (0 < $remainingCount) { |
| 691 | 691 | if (!is_null($queryParameterString)) { |
| 692 | 692 | $queryParameterString .= '&'; |
| 693 | 693 | } |
| 694 | 694 | |
| 695 | - $queryParameterString .= ODataConstants::HTTPQUERY_STRING_TOP . '=' . $remainingCount; |
|
| 695 | + $queryParameterString .= ODataConstants::HTTPQUERY_STRING_TOP.'='.$remainingCount; |
|
| 696 | 696 | } |
| 697 | 697 | } |
| 698 | 698 | |
@@ -721,7 +721,7 @@ discard block |
||
| 721 | 721 | * |
| 722 | 722 | * @return string |
| 723 | 723 | */ |
| 724 | - private function primitiveToString(IType &$type, $primitiveValue) |
|
| 724 | + private function primitiveToString(IType & $type, $primitiveValue) |
|
| 725 | 725 | { |
| 726 | 726 | if ($type instanceof Boolean) { |
| 727 | 727 | $stringValue = (true === $primitiveValue) ? 'true' : 'false'; |
@@ -793,7 +793,7 @@ discard block |
||
| 793 | 793 | $nuLink->expandedResult->selfLink->title = $propName; |
| 794 | 794 | $nuLink->expandedResult->selfLink->url = $nuLink->url; |
| 795 | 795 | $nuLink->expandedResult->title = $propName; |
| 796 | - $nuLink->expandedResult->id = rtrim($this->absoluteServiceUri, '/') . '/' . $nuLink->url; |
|
| 796 | + $nuLink->expandedResult->id = rtrim($this->absoluteServiceUri, '/').'/'.$nuLink->url; |
|
| 797 | 797 | } |
| 798 | 798 | } |
| 799 | 799 | } |
@@ -807,7 +807,7 @@ discard block |
||
| 807 | 807 | { |
| 808 | 808 | $this->service = $service; |
| 809 | 809 | $this->absoluteServiceUri = $service->getHost()->getAbsoluteServiceUri()->getUrlAsString(); |
| 810 | - $this->absoluteServiceUriWithSlash = rtrim($this->absoluteServiceUri, '/') . '/'; |
|
| 810 | + $this->absoluteServiceUriWithSlash = rtrim($this->absoluteServiceUri, '/').'/'; |
|
| 811 | 811 | } |
| 812 | 812 | |
| 813 | 813 | /** |
@@ -815,7 +815,7 @@ discard block |
||
| 815 | 815 | * @param $result |
| 816 | 816 | * @return ODataBagContent |
| 817 | 817 | */ |
| 818 | - protected function writeBagValue(ResourceType &$resourceType, $result) |
|
| 818 | + protected function writeBagValue(ResourceType & $resourceType, $result) |
|
| 819 | 819 | { |
| 820 | 820 | assert(null == $result || is_array($result), 'Bag parameter must be null or array'); |
| 821 | 821 | $typeKind = $resourceType->getResourceTypeKind(); |
@@ -847,7 +847,7 @@ discard block |
||
| 847 | 847 | * @param string $propertyName |
| 848 | 848 | * @return ODataPropertyContent |
| 849 | 849 | */ |
| 850 | - protected function writeComplexValue(ResourceType &$resourceType, &$result, $propertyName = null) |
|
| 850 | + protected function writeComplexValue(ResourceType & $resourceType, &$result, $propertyName = null) |
|
| 851 | 851 | { |
| 852 | 852 | assert(is_object($result), 'Supplied $customObject must be an object'); |
| 853 | 853 | |