@@ -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) { |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $this->service = $service; |
99 | 99 | $this->request = $request; |
100 | 100 | $this->absoluteServiceUri = $service->getHost()->getAbsoluteServiceUri()->getUrlAsString(); |
101 | - $this->absoluteServiceUriWithSlash = rtrim($this->absoluteServiceUri, '/') . '/'; |
|
101 | + $this->absoluteServiceUriWithSlash = rtrim($this->absoluteServiceUri, '/').'/'; |
|
102 | 102 | $this->stack = new SegmentStack($request); |
103 | 103 | $this->complexTypeInstanceCollection = []; |
104 | 104 | $this->modelSerialiser = new ModelSerialiser(); |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | $resourceType, |
145 | 145 | $resourceSet->getName() |
146 | 146 | ); |
147 | - $absoluteUri = rtrim($this->absoluteServiceUri, '/') . '/' . $relativeUri; |
|
147 | + $absoluteUri = rtrim($this->absoluteServiceUri, '/').'/'.$relativeUri; |
|
148 | 148 | |
149 | 149 | list($mediaLink, $mediaLinks) = $this->writeMediaData($entryObject->results, $type, $relativeUri, $resourceType); |
150 | 150 | |
@@ -165,8 +165,8 @@ discard block |
||
165 | 165 | $propType = 'application/atom+xml;type='.$propTail; |
166 | 166 | $propName = $prop->getName(); |
167 | 167 | $nuLink->title = $propName; |
168 | - $nuLink->name = ODataConstants::ODATA_RELATED_NAMESPACE . $propName; |
|
169 | - $nuLink->url = $relativeUri . '/' . $propName; |
|
168 | + $nuLink->name = ODataConstants::ODATA_RELATED_NAMESPACE.$propName; |
|
169 | + $nuLink->url = $relativeUri.'/'.$propName; |
|
170 | 170 | $nuLink->type = $propType; |
171 | 171 | |
172 | 172 | $navProp = new ODataNavigationPropertyInfo($prop, $this->shouldExpandSegment($propName)); |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | * |
203 | 203 | * @return ODataFeed |
204 | 204 | */ |
205 | - public function writeTopLevelElements(QueryResult &$entryObjects) |
|
205 | + public function writeTopLevelElements(QueryResult & $entryObjects) |
|
206 | 206 | { |
207 | 207 | assert(is_array($entryObjects->results), '!is_array($entryObjects->results)'); |
208 | 208 | |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | $resourceSet = $this->getRequest()->getTargetResourceSetWrapper()->getResourceSet(); |
240 | 240 | $requestTop = $this->getRequest()->getTopOptionCount(); |
241 | 241 | $pageSize = $this->getService()->getConfiguration()->getEntitySetPageSize($resourceSet); |
242 | - $requestTop = (null == $requestTop) ? $pageSize + 1 : $requestTop; |
|
242 | + $requestTop = (null == $requestTop) ? $pageSize+1 : $requestTop; |
|
243 | 243 | |
244 | 244 | if (true === $entryObjects->hasMore && $requestTop > $pageSize) { |
245 | 245 | $stackSegment = $setName; |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | $segment = $this->getNextLinkUri($lastObject, $absoluteUri); |
248 | 248 | $nextLink = new ODataLink(); |
249 | 249 | $nextLink->name = ODataConstants::ATOM_LINK_NEXT_ATTRIBUTE_STRING; |
250 | - $nextLink->url = rtrim($this->absoluteServiceUri, '/') . '/' . $stackSegment . $segment; |
|
250 | + $nextLink->url = rtrim($this->absoluteServiceUri, '/').'/'.$stackSegment.$segment; |
|
251 | 251 | $odata->nextPageLink = $nextLink; |
252 | 252 | } |
253 | 253 | |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | $this->getCurrentResourceSetWrapper()->getName() |
273 | 273 | ); |
274 | 274 | |
275 | - $url->url = rtrim($this->absoluteServiceUri, '/') . '/' . $relativeUri; |
|
275 | + $url->url = rtrim($this->absoluteServiceUri, '/').'/'.$relativeUri; |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | return $url; |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | $segment = $this->getNextLinkUri($lastObject, $this->getRequest()->getRequestUrl()->getUrlAsString()); |
303 | 303 | $nextLink = new ODataLink(); |
304 | 304 | $nextLink->name = ODataConstants::ATOM_LINK_NEXT_ATTRIBUTE_STRING; |
305 | - $nextLink->url = rtrim($this->absoluteServiceUri, '/') . '/' . $stackSegment . $segment; |
|
305 | + $nextLink->url = rtrim($this->absoluteServiceUri, '/').'/'.$stackSegment.$segment; |
|
306 | 306 | $urls->nextPageLink = $nextLink; |
307 | 307 | } |
308 | 308 | } |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | * |
327 | 327 | * @return ODataPropertyContent |
328 | 328 | */ |
329 | - public function writeTopLevelComplexObject(QueryResult &$complexValue, $propertyName, ResourceType &$resourceType) |
|
329 | + public function writeTopLevelComplexObject(QueryResult & $complexValue, $propertyName, ResourceType & $resourceType) |
|
330 | 330 | { |
331 | 331 | $result = $complexValue->results; |
332 | 332 | |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | * bag object |
356 | 356 | * @return ODataPropertyContent |
357 | 357 | */ |
358 | - public function writeTopLevelBagObject(QueryResult &$BagValue, $propertyName, ResourceType &$resourceType) |
|
358 | + public function writeTopLevelBagObject(QueryResult & $BagValue, $propertyName, ResourceType & $resourceType) |
|
359 | 359 | { |
360 | 360 | $result = $BagValue->results; |
361 | 361 | |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | * primitive property to be written |
379 | 379 | * @return ODataPropertyContent |
380 | 380 | */ |
381 | - public function writeTopLevelPrimitive(QueryResult &$primitiveValue, ResourceProperty &$resourceProperty = null) |
|
381 | + public function writeTopLevelPrimitive(QueryResult & $primitiveValue, ResourceProperty & $resourceProperty = null) |
|
382 | 382 | { |
383 | 383 | assert(null != $resourceProperty, "Resource property must not be null"); |
384 | 384 | $propertyContent = new ODataPropertyContent(); |
@@ -446,7 +446,7 @@ discard block |
||
446 | 446 | $typeName = $resourceType->getName(); |
447 | 447 | $keyProperties = $resourceType->getKeyProperties(); |
448 | 448 | assert(count($keyProperties) != 0, 'count($keyProperties) == 0'); |
449 | - $keyString = $containerName . '('; |
|
449 | + $keyString = $containerName.'('; |
|
450 | 450 | $comma = null; |
451 | 451 | foreach ($keyProperties as $keyName => $resourceProperty) { |
452 | 452 | $keyType = $resourceProperty->getInstanceType(); |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | } |
461 | 461 | |
462 | 462 | $keyValue = $keyType->convertToOData($keyValue); |
463 | - $keyString .= $comma . $keyName . '=' . $keyValue; |
|
463 | + $keyString .= $comma.$keyName.'='.$keyValue; |
|
464 | 464 | $comma = ','; |
465 | 465 | } |
466 | 466 | |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | $mediaLink = null; |
486 | 486 | if ($resourceType->isMediaLinkEntry()) { |
487 | 487 | $eTag = $streamProviderWrapper->getStreamETag2($entryObject, null, $context); |
488 | - $mediaLink = new ODataMediaLink($type, '/$value', $relativeUri . '/$value', '*/*', $eTag); |
|
488 | + $mediaLink = new ODataMediaLink($type, '/$value', $relativeUri.'/$value', '*/*', $eTag); |
|
489 | 489 | } |
490 | 490 | $mediaLinks = []; |
491 | 491 | if ($resourceType->hasNamedStream()) { |
@@ -626,7 +626,7 @@ discard block |
||
626 | 626 | $segmentWrappers = $this->getStack()->getSegmentWrappers(); |
627 | 627 | $count = count($segmentWrappers); |
628 | 628 | |
629 | - return 0 == $count ? $this->getRequest()->getTargetResourceSetWrapper() : $segmentWrappers[$count - 1]; |
|
629 | + return 0 == $count ? $this->getRequest()->getTargetResourceSetWrapper() : $segmentWrappers[$count-1]; |
|
630 | 630 | } |
631 | 631 | |
632 | 632 | /** |
@@ -676,22 +676,22 @@ discard block |
||
676 | 676 | $value = $this->getService()->getHost()->getQueryStringItem($queryOption); |
677 | 677 | if (!is_null($value)) { |
678 | 678 | if (!is_null($queryParameterString)) { |
679 | - $queryParameterString = $queryParameterString . '&'; |
|
679 | + $queryParameterString = $queryParameterString.'&'; |
|
680 | 680 | } |
681 | 681 | |
682 | - $queryParameterString .= $queryOption . '=' . $value; |
|
682 | + $queryParameterString .= $queryOption.'='.$value; |
|
683 | 683 | } |
684 | 684 | } |
685 | 685 | |
686 | 686 | $topCountValue = $this->getRequest()->getTopOptionCount(); |
687 | 687 | if (!is_null($topCountValue)) { |
688 | - $remainingCount = $topCountValue - $this->getRequest()->getTopCount(); |
|
688 | + $remainingCount = $topCountValue-$this->getRequest()->getTopCount(); |
|
689 | 689 | if (0 < $remainingCount) { |
690 | 690 | if (!is_null($queryParameterString)) { |
691 | 691 | $queryParameterString .= '&'; |
692 | 692 | } |
693 | 693 | |
694 | - $queryParameterString .= ODataConstants::HTTPQUERY_STRING_TOP . '=' . $remainingCount; |
|
694 | + $queryParameterString .= ODataConstants::HTTPQUERY_STRING_TOP.'='.$remainingCount; |
|
695 | 695 | } |
696 | 696 | } |
697 | 697 | |
@@ -720,7 +720,7 @@ discard block |
||
720 | 720 | * |
721 | 721 | * @return string |
722 | 722 | */ |
723 | - private function primitiveToString(IType &$type, $primitiveValue) |
|
723 | + private function primitiveToString(IType & $type, $primitiveValue) |
|
724 | 724 | { |
725 | 725 | if ($type instanceof Boolean) { |
726 | 726 | $stringValue = (true === $primitiveValue) ? 'true' : 'false'; |
@@ -792,7 +792,7 @@ discard block |
||
792 | 792 | $nuLink->expandedResult->selfLink->title = $propName; |
793 | 793 | $nuLink->expandedResult->selfLink->url = $nuLink->url; |
794 | 794 | $nuLink->expandedResult->title = $propName; |
795 | - $nuLink->expandedResult->id = rtrim($this->absoluteServiceUri, '/') . '/' . $nuLink->url; |
|
795 | + $nuLink->expandedResult->id = rtrim($this->absoluteServiceUri, '/').'/'.$nuLink->url; |
|
796 | 796 | } |
797 | 797 | } |
798 | 798 | } |
@@ -806,7 +806,7 @@ discard block |
||
806 | 806 | { |
807 | 807 | $this->service = $service; |
808 | 808 | $this->absoluteServiceUri = $service->getHost()->getAbsoluteServiceUri()->getUrlAsString(); |
809 | - $this->absoluteServiceUriWithSlash = rtrim($this->absoluteServiceUri, '/') . '/'; |
|
809 | + $this->absoluteServiceUriWithSlash = rtrim($this->absoluteServiceUri, '/').'/'; |
|
810 | 810 | } |
811 | 811 | |
812 | 812 | /** |
@@ -814,7 +814,7 @@ discard block |
||
814 | 814 | * @param $result |
815 | 815 | * @return ODataBagContent |
816 | 816 | */ |
817 | - protected function writeBagValue(ResourceType &$resourceType, $result) |
|
817 | + protected function writeBagValue(ResourceType & $resourceType, $result) |
|
818 | 818 | { |
819 | 819 | assert(null == $result || is_array($result), 'Bag parameter must be null or array'); |
820 | 820 | $typeKind = $resourceType->getResourceTypeKind(); |
@@ -845,7 +845,7 @@ discard block |
||
845 | 845 | * @param object $result |
846 | 846 | * @return ODataPropertyContent |
847 | 847 | */ |
848 | - protected function writeComplexValue(ResourceType &$resourceType, $result) |
|
848 | + protected function writeComplexValue(ResourceType & $resourceType, $result) |
|
849 | 849 | { |
850 | 850 | assert(is_object($result), 'Supplied $customObject must be an object'); |
851 | 851 | $internalContent = new ODataPropertyContent(); |