@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | /** |
| 106 | 106 | * Write a top level entry resource. |
| 107 | 107 | * |
| 108 | - * @param mixed $entryObject Reference to the entry object to be written |
|
| 108 | + * @param QueryResult $entryObject Reference to the entry object to be written |
|
| 109 | 109 | * |
| 110 | 110 | * @return ODataEntry |
| 111 | 111 | */ |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | /** |
| 251 | 251 | * Write top level url element. |
| 252 | 252 | * |
| 253 | - * @param mixed $entryObject The entry resource whose url to be written |
|
| 253 | + * @param QueryResult $entryObject The entry resource whose url to be written |
|
| 254 | 254 | * |
| 255 | 255 | * @return ODataURL |
| 256 | 256 | */ |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | /** |
| 275 | 275 | * Write top level url collection. |
| 276 | 276 | * |
| 277 | - * @param array $entryObjects Array of entry resources |
|
| 277 | + * @param QueryResult $entryObjects Array of entry resources |
|
| 278 | 278 | * whose url to be written |
| 279 | 279 | * |
| 280 | 280 | * @return ODataURLCollection |
@@ -402,6 +402,9 @@ discard block |
||
| 402 | 402 | return $this->stack; |
| 403 | 403 | } |
| 404 | 404 | |
| 405 | + /** |
|
| 406 | + * @param string $containerName |
|
| 407 | + */ |
|
| 405 | 408 | protected function getEntryInstanceKey($entityInstance, ResourceType $resourceType, $containerName) |
| 406 | 409 | { |
| 407 | 410 | $typeName = $resourceType->getName(); |
@@ -433,7 +436,7 @@ discard block |
||
| 433 | 436 | /** |
| 434 | 437 | * @param $entryObject |
| 435 | 438 | * @param $type |
| 436 | - * @param $relativeUri |
|
| 439 | + * @param string $relativeUri |
|
| 437 | 440 | * @param $resourceType |
| 438 | 441 | * @return array |
| 439 | 442 | */ |
@@ -500,7 +503,7 @@ discard block |
||
| 500 | 503 | * Find a 'ExpandedProjectionNode' instance in the projection tree |
| 501 | 504 | * which describes the current segment. |
| 502 | 505 | * |
| 503 | - * @return ExpandedProjectionNode|null |
|
| 506 | + * @return null|\POData\UriProcessor\QueryProcessor\ExpandProjectionParser\RootProjectionNode|ExpandedProjectionNode |
|
| 504 | 507 | */ |
| 505 | 508 | protected function getCurrentExpandedProjectionNode() |
| 506 | 509 | { |
@@ -723,7 +726,7 @@ discard block |
||
| 723 | 726 | /** |
| 724 | 727 | * @param $entryObject |
| 725 | 728 | * @param $prop |
| 726 | - * @param $nuLink |
|
| 729 | + * @param ODataLink $nuLink |
|
| 727 | 730 | * @param $propKind |
| 728 | 731 | * @param $propName |
| 729 | 732 | */ |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | $this->service = $service; |
| 97 | 97 | $this->request = $request; |
| 98 | 98 | $this->absoluteServiceUri = $service->getHost()->getAbsoluteServiceUri()->getUrlAsString(); |
| 99 | - $this->absoluteServiceUriWithSlash = rtrim($this->absoluteServiceUri, '/') . '/'; |
|
| 99 | + $this->absoluteServiceUriWithSlash = rtrim($this->absoluteServiceUri, '/').'/'; |
|
| 100 | 100 | $this->stack = new SegmentStack($request); |
| 101 | 101 | $this->complexTypeInstanceCollection = []; |
| 102 | 102 | $this->modelSerialiser = new ModelSerialiser(); |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | $resourceType, |
| 143 | 143 | $resourceSet->getName() |
| 144 | 144 | ); |
| 145 | - $absoluteUri = rtrim($this->absoluteServiceUri, '/') . '/' . $relativeUri; |
|
| 145 | + $absoluteUri = rtrim($this->absoluteServiceUri, '/').'/'.$relativeUri; |
|
| 146 | 146 | |
| 147 | 147 | list($mediaLink, $mediaLinks) = $this->writeMediaData($entryObject->results, $type, $relativeUri, $resourceType); |
| 148 | 148 | |
@@ -163,8 +163,8 @@ discard block |
||
| 163 | 163 | $propType = 'application/atom+xml;type='.$propTail; |
| 164 | 164 | $propName = $prop->getName(); |
| 165 | 165 | $nuLink->title = $propName; |
| 166 | - $nuLink->name = ODataConstants::ODATA_RELATED_NAMESPACE . $propName; |
|
| 167 | - $nuLink->url = $relativeUri . '/' . $propName; |
|
| 166 | + $nuLink->name = ODataConstants::ODATA_RELATED_NAMESPACE.$propName; |
|
| 167 | + $nuLink->url = $relativeUri.'/'.$propName; |
|
| 168 | 168 | $nuLink->type = $propType; |
| 169 | 169 | |
| 170 | 170 | $navProp = new ODataNavigationPropertyInfo($prop, $this->shouldExpandSegment($propName)); |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | * |
| 201 | 201 | * @return ODataFeed |
| 202 | 202 | */ |
| 203 | - public function writeTopLevelElements(QueryResult &$entryObjects) |
|
| 203 | + public function writeTopLevelElements(QueryResult & $entryObjects) |
|
| 204 | 204 | { |
| 205 | 205 | assert(is_array($entryObjects->results), '!is_array($entryObjects->results)'); |
| 206 | 206 | |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | $segment = $this->getNextLinkUri($lastObject, $absoluteUri); |
| 241 | 241 | $nextLink = new ODataLink(); |
| 242 | 242 | $nextLink->name = ODataConstants::ATOM_LINK_NEXT_ATTRIBUTE_STRING; |
| 243 | - $nextLink->url = rtrim($this->absoluteServiceUri, '/') . '/' . $stackSegment . $segment; |
|
| 243 | + $nextLink->url = rtrim($this->absoluteServiceUri, '/').'/'.$stackSegment.$segment; |
|
| 244 | 244 | $odata->nextPageLink = $nextLink; |
| 245 | 245 | } |
| 246 | 246 | |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | $this->getCurrentResourceSetWrapper()->getName() |
| 266 | 266 | ); |
| 267 | 267 | |
| 268 | - $url->url = rtrim($this->absoluteServiceUri, '/') . '/' . $relativeUri; |
|
| 268 | + $url->url = rtrim($this->absoluteServiceUri, '/').'/'.$relativeUri; |
|
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | return $url; |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | $segment = $this->getNextLinkUri($lastObject, $this->getRequest()->getRequestUrl()->getUrlAsString()); |
| 296 | 296 | $nextLink = new ODataLink(); |
| 297 | 297 | $nextLink->name = ODataConstants::ATOM_LINK_NEXT_ATTRIBUTE_STRING; |
| 298 | - $nextLink->url = rtrim($this->absoluteServiceUri, '/') . '/' . $stackSegment . $segment; |
|
| 298 | + $nextLink->url = rtrim($this->absoluteServiceUri, '/').'/'.$stackSegment.$segment; |
|
| 299 | 299 | $urls->nextPageLink = $nextLink; |
| 300 | 300 | } |
| 301 | 301 | } |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | * @return ODataPropertyContent |
| 321 | 321 | * @codeCoverageIgnore |
| 322 | 322 | */ |
| 323 | - public function writeTopLevelComplexObject(QueryResult &$complexValue, $propertyName, ResourceType &$resourceType) |
|
| 323 | + public function writeTopLevelComplexObject(QueryResult & $complexValue, $propertyName, ResourceType & $resourceType) |
|
| 324 | 324 | { |
| 325 | 325 | // TODO: Figure out if we need to bother implementing this |
| 326 | 326 | } |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | * @codeCoverageIgnore |
| 338 | 338 | * @return ODataPropertyContent |
| 339 | 339 | */ |
| 340 | - public function writeTopLevelBagObject(QueryResult &$BagValue, $propertyName, ResourceType &$resourceType) |
|
| 340 | + public function writeTopLevelBagObject(QueryResult & $BagValue, $propertyName, ResourceType & $resourceType) |
|
| 341 | 341 | { |
| 342 | 342 | // TODO: Figure out if we need to bother implementing this |
| 343 | 343 | } |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | * @codeCoverageIgnore |
| 355 | 355 | * @return ODataPropertyContent |
| 356 | 356 | */ |
| 357 | - public function writeTopLevelPrimitive(QueryResult &$primitiveValue, ResourceProperty &$resourceProperty = null) |
|
| 357 | + public function writeTopLevelPrimitive(QueryResult & $primitiveValue, ResourceProperty & $resourceProperty = null) |
|
| 358 | 358 | { |
| 359 | 359 | // TODO: Figure out if we need to bother implementing this |
| 360 | 360 | } |
@@ -407,7 +407,7 @@ discard block |
||
| 407 | 407 | $typeName = $resourceType->getName(); |
| 408 | 408 | $keyProperties = $resourceType->getKeyProperties(); |
| 409 | 409 | assert(count($keyProperties) != 0, 'count($keyProperties) == 0'); |
| 410 | - $keyString = $containerName . '('; |
|
| 410 | + $keyString = $containerName.'('; |
|
| 411 | 411 | $comma = null; |
| 412 | 412 | foreach ($keyProperties as $keyName => $resourceProperty) { |
| 413 | 413 | $keyType = $resourceProperty->getInstanceType(); |
@@ -421,7 +421,7 @@ discard block |
||
| 421 | 421 | } |
| 422 | 422 | |
| 423 | 423 | $keyValue = $keyType->convertToOData($keyValue); |
| 424 | - $keyString .= $comma . $keyName . '=' . $keyValue; |
|
| 424 | + $keyString .= $comma.$keyName.'='.$keyValue; |
|
| 425 | 425 | $comma = ','; |
| 426 | 426 | } |
| 427 | 427 | |
@@ -446,7 +446,7 @@ discard block |
||
| 446 | 446 | $mediaLink = null; |
| 447 | 447 | if ($resourceType->isMediaLinkEntry()) { |
| 448 | 448 | $eTag = $streamProviderWrapper->getStreamETag2($entryObject, null, $context); |
| 449 | - $mediaLink = new ODataMediaLink($type, '/$value', $relativeUri . '/$value', '*/*', $eTag); |
|
| 449 | + $mediaLink = new ODataMediaLink($type, '/$value', $relativeUri.'/$value', '*/*', $eTag); |
|
| 450 | 450 | } |
| 451 | 451 | $mediaLinks = []; |
| 452 | 452 | if ($resourceType->hasNamedStream()) { |
@@ -587,7 +587,7 @@ discard block |
||
| 587 | 587 | $segmentWrappers = $this->getStack()->getSegmentWrappers(); |
| 588 | 588 | $count = count($segmentWrappers); |
| 589 | 589 | |
| 590 | - return 0 == $count ? $this->getRequest()->getTargetResourceSetWrapper() : $segmentWrappers[$count - 1]; |
|
| 590 | + return 0 == $count ? $this->getRequest()->getTargetResourceSetWrapper() : $segmentWrappers[$count-1]; |
|
| 591 | 591 | } |
| 592 | 592 | |
| 593 | 593 | /** |
@@ -637,21 +637,21 @@ discard block |
||
| 637 | 637 | $value = $this->getService()->getHost()->getQueryStringItem($queryOption); |
| 638 | 638 | if (!is_null($value)) { |
| 639 | 639 | if (!is_null($queryParameterString)) { |
| 640 | - $queryParameterString = $queryParameterString . '&'; |
|
| 640 | + $queryParameterString = $queryParameterString.'&'; |
|
| 641 | 641 | } |
| 642 | 642 | |
| 643 | - $queryParameterString .= $queryOption . '=' . $value; |
|
| 643 | + $queryParameterString .= $queryOption.'='.$value; |
|
| 644 | 644 | } |
| 645 | 645 | } |
| 646 | 646 | |
| 647 | 647 | $topCountValue = $this->getRequest()->getTopOptionCount(); |
| 648 | 648 | if (!is_null($topCountValue)) { |
| 649 | - $remainingCount = $topCountValue - $this->getRequest()->getTopCount(); |
|
| 649 | + $remainingCount = $topCountValue-$this->getRequest()->getTopCount(); |
|
| 650 | 650 | if (!is_null($queryParameterString)) { |
| 651 | 651 | $queryParameterString .= '&'; |
| 652 | 652 | } |
| 653 | 653 | |
| 654 | - $queryParameterString .= ODataConstants::HTTPQUERY_STRING_TOP . '=' . $remainingCount; |
|
| 654 | + $queryParameterString .= ODataConstants::HTTPQUERY_STRING_TOP.'='.$remainingCount; |
|
| 655 | 655 | } |
| 656 | 656 | |
| 657 | 657 | if (!is_null($queryParameterString)) { |
@@ -679,7 +679,7 @@ discard block |
||
| 679 | 679 | * |
| 680 | 680 | * @return string |
| 681 | 681 | */ |
| 682 | - private function primitiveToString(IType &$type, $primitiveValue) |
|
| 682 | + private function primitiveToString(IType & $type, $primitiveValue) |
|
| 683 | 683 | { |
| 684 | 684 | if ($type instanceof Boolean) { |
| 685 | 685 | $stringValue = (true === $primitiveValue) ? 'true' : 'false'; |
@@ -751,7 +751,7 @@ discard block |
||
| 751 | 751 | $nuLink->expandedResult->selfLink->title = $propName; |
| 752 | 752 | $nuLink->expandedResult->selfLink->url = $nuLink->url; |
| 753 | 753 | $nuLink->expandedResult->title = $propName; |
| 754 | - $nuLink->expandedResult->id = rtrim($this->absoluteServiceUri, '/') . '/' . $nuLink->url; |
|
| 754 | + $nuLink->expandedResult->id = rtrim($this->absoluteServiceUri, '/').'/'.$nuLink->url; |
|
| 755 | 755 | } |
| 756 | 756 | } |
| 757 | 757 | } |
@@ -765,6 +765,6 @@ discard block |
||
| 765 | 765 | { |
| 766 | 766 | $this->service = $service; |
| 767 | 767 | $this->absoluteServiceUri = $service->getHost()->getAbsoluteServiceUri()->getUrlAsString(); |
| 768 | - $this->absoluteServiceUriWithSlash = rtrim($this->absoluteServiceUri, '/') . '/'; |
|
| 768 | + $this->absoluteServiceUriWithSlash = rtrim($this->absoluteServiceUri, '/').'/'; |
|
| 769 | 769 | } |
| 770 | 770 | } |
@@ -153,14 +153,14 @@ discard block |
||
| 153 | 153 | // loop thru, chunk by chunk, to reduce chances of exhausting memory |
| 154 | 154 | $sourceEntityInstance->chunk( |
| 155 | 155 | 5000, |
| 156 | - function ($results) use ($isvalid, &$skip, &$resultSet, &$rawCount, $rawTop) { |
|
| 156 | + function($results) use ($isvalid, &$skip, &$resultSet, &$rawCount, $rawTop) { |
|
| 157 | 157 | // apply filter |
| 158 | 158 | $results = $results->filter($isvalid); |
| 159 | 159 | // need to iterate through full result set to find count of items matching filter, |
| 160 | 160 | // so we can't bail out early |
| 161 | 161 | $rawCount += $results->count(); |
| 162 | 162 | // now bolt on filtrate to accumulating result set if we haven't accumulated enough bitz |
| 163 | - if ($rawTop > $resultSet->count() + $skip) { |
|
| 163 | + if ($rawTop > $resultSet->count()+$skip) { |
|
| 164 | 164 | $resultSet = collect(array_merge($resultSet->all(), $results->all())); |
| 165 | 165 | $sliceAmount = min($skip, $resultSet->count()); |
| 166 | 166 | $resultSet = $resultSet->slice($sliceAmount); |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | if (QueryType::COUNT() == $queryType || QueryType::ENTITIES_WITH_COUNT() == $queryType) { |
| 200 | 200 | $result->count = $resultCount; |
| 201 | 201 | } |
| 202 | - $hazMore = $bulkSetCount > $skip + count($resultSet); |
|
| 202 | + $hazMore = $bulkSetCount > $skip+count($resultSet); |
|
| 203 | 203 | $result->hasMore = $hazMore; |
| 204 | 204 | return $result; |
| 205 | 205 | } |