@@ -378,7 +378,7 @@ |
||
| 378 | 378 | * NULL for complex object. |
| 379 | 379 | * @param string $relativeUri Relative uri for the given |
| 380 | 380 | * custom object. |
| 381 | - * @param ODataEntry &$odataEntry ODataEntry instance to |
|
| 381 | + * @param ODataEntry ODataEntry|null ODataEntry instance to |
|
| 382 | 382 | * place links and |
| 383 | 383 | * expansion of the |
| 384 | 384 | * entry object, |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | $needPop = $this->pushSegmentForRoot(); |
| 68 | 68 | $entry = $this->_writeEntryElement( |
| 69 | 69 | $entryObject, |
| 70 | - $resourceType, |
|
| 70 | + $resourceType, |
|
| 71 | 71 | $this->request->getRequestUrl()->getUrlAsString(), |
| 72 | 72 | $this->request->getContainerName() |
| 73 | 73 | ); |
@@ -190,18 +190,18 @@ discard block |
||
| 190 | 190 | * @return ODataPropertyContent |
| 191 | 191 | */ |
| 192 | 192 | public function writeTopLevelComplexObject( |
| 193 | - &$complexValue, |
|
| 193 | + &$complexValue, |
|
| 194 | 194 | $propertyName, |
| 195 | 195 | ResourceType &$resourceType |
| 196 | 196 | ) { |
| 197 | - $propertyContent = new ODataPropertyContent(); |
|
| 197 | + $propertyContent = new ODataPropertyContent(); |
|
| 198 | 198 | $this->_writeComplexValue( |
| 199 | 199 | $complexValue, |
| 200 | 200 | $propertyName, $resourceType, null, |
| 201 | - $propertyContent |
|
| 201 | + $propertyContent |
|
| 202 | 202 | ); |
| 203 | 203 | |
| 204 | - return $propertyContent; |
|
| 204 | + return $propertyContent; |
|
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | /** |
@@ -217,19 +217,19 @@ discard block |
||
| 217 | 217 | * @return ODataPropertyContent |
| 218 | 218 | */ |
| 219 | 219 | public function writeTopLevelBagObject( |
| 220 | - &$BagValue, |
|
| 220 | + &$BagValue, |
|
| 221 | 221 | $propertyName, |
| 222 | 222 | ResourceType &$resourceType |
| 223 | 223 | ) { |
| 224 | 224 | |
| 225 | - $propertyContent = new ODataPropertyContent(); |
|
| 225 | + $propertyContent = new ODataPropertyContent(); |
|
| 226 | 226 | $this->_writeBagValue( |
| 227 | 227 | $BagValue, |
| 228 | 228 | $propertyName, $resourceType, null, |
| 229 | - $propertyContent |
|
| 229 | + $propertyContent |
|
| 230 | 230 | ); |
| 231 | 231 | |
| 232 | - return $propertyContent; |
|
| 232 | + return $propertyContent; |
|
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | /** |
@@ -245,18 +245,18 @@ discard block |
||
| 245 | 245 | * @return ODataPropertyContent |
| 246 | 246 | */ |
| 247 | 247 | public function writeTopLevelPrimitive( |
| 248 | - &$primitiveValue, |
|
| 248 | + &$primitiveValue, |
|
| 249 | 249 | ResourceProperty &$resourceProperty |
| 250 | 250 | ) { |
| 251 | - $propertyContent = new ODataPropertyContent(); |
|
| 252 | - $propertyContent->properties[] = new ODataProperty(); |
|
| 251 | + $propertyContent = new ODataPropertyContent(); |
|
| 252 | + $propertyContent->properties[] = new ODataProperty(); |
|
| 253 | 253 | $this->_writePrimitiveValue( |
| 254 | 254 | $primitiveValue, |
| 255 | 255 | $resourceProperty, |
| 256 | - $propertyContent->properties[0] |
|
| 256 | + $propertyContent->properties[0] |
|
| 257 | 257 | ); |
| 258 | 258 | |
| 259 | - return $propertyContent; |
|
| 259 | + return $propertyContent; |
|
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | /** |
@@ -275,8 +275,8 @@ discard block |
||
| 275 | 275 | $absoluteUri, |
| 276 | 276 | $relativeUri |
| 277 | 277 | ) { |
| 278 | - $entry = new ODataEntry(); |
|
| 279 | - $entry->resourceSetName = $this->getCurrentResourceSetWrapper()->getName(); |
|
| 278 | + $entry = new ODataEntry(); |
|
| 279 | + $entry->resourceSetName = $this->getCurrentResourceSetWrapper()->getName(); |
|
| 280 | 280 | |
| 281 | 281 | if (is_null($entryObject)) { |
| 282 | 282 | //According to atom standard an empty entry must have an Author |
@@ -297,27 +297,27 @@ discard block |
||
| 297 | 297 | $actualResourceType, |
| 298 | 298 | $title, |
| 299 | 299 | $relativeUri, |
| 300 | - $entry |
|
| 300 | + $entry |
|
| 301 | 301 | ); |
| 302 | 302 | |
| 303 | - $entry->id = $absoluteUri; |
|
| 304 | - $entry->eTag = $this->getETagForEntry($entryObject, $resourceType); |
|
| 305 | - $entry->title = $title; |
|
| 306 | - $entry->editLink = $relativeUri; |
|
| 307 | - $entry->type = $actualResourceType->getFullName(); |
|
| 303 | + $entry->id = $absoluteUri; |
|
| 304 | + $entry->eTag = $this->getETagForEntry($entryObject, $resourceType); |
|
| 305 | + $entry->title = $title; |
|
| 306 | + $entry->editLink = $relativeUri; |
|
| 307 | + $entry->type = $actualResourceType->getFullName(); |
|
| 308 | 308 | $odataPropertyContent = new ODataPropertyContent(); |
| 309 | 309 | $this->_writeObjectProperties( |
| 310 | 310 | $entryObject, |
| 311 | 311 | $actualResourceType, |
| 312 | 312 | $absoluteUri, |
| 313 | 313 | $relativeUri, |
| 314 | - $entry, |
|
| 314 | + $entry, |
|
| 315 | 315 | $odataPropertyContent |
| 316 | 316 | ); |
| 317 | - $entry->propertyContent = $odataPropertyContent; |
|
| 317 | + $entry->propertyContent = $odataPropertyContent; |
|
| 318 | 318 | } |
| 319 | 319 | |
| 320 | - return $entry; |
|
| 320 | + return $entry; |
|
| 321 | 321 | } |
| 322 | 322 | |
| 323 | 323 | /** |
@@ -390,7 +390,7 @@ discard block |
||
| 390 | 390 | * @return void |
| 391 | 391 | */ |
| 392 | 392 | private function _writeObjectProperties( |
| 393 | - $customObject, |
|
| 393 | + $customObject, |
|
| 394 | 394 | ResourceType &$resourceType, |
| 395 | 395 | $absoluteUri, |
| 396 | 396 | $relativeUri, |
@@ -488,14 +488,14 @@ discard block |
||
| 488 | 488 | ) { |
| 489 | 489 | continue; |
| 490 | 490 | } else { |
| 491 | - $this->assert( |
|
| 492 | - ($resourcePropertyKind == ResourcePropertyKind::RESOURCE_REFERENCE) |
|
| 491 | + $this->assert( |
|
| 492 | + ($resourcePropertyKind == ResourcePropertyKind::RESOURCE_REFERENCE) |
|
| 493 | 493 | || ($resourcePropertyKind == ResourcePropertyKind::RESOURCESET_REFERENCE) |
| 494 | 494 | || ($resourcePropertyKind == ResourcePropertyKind::KEY_RESOURCE_REFERENCE), |
| 495 | - '($resourcePropertyKind == ResourcePropertyKind::RESOURCE_REFERENCE) |
|
| 495 | + '($resourcePropertyKind == ResourcePropertyKind::RESOURCE_REFERENCE) |
|
| 496 | 496 | || ($resourcePropertyKind == ResourcePropertyKind::RESOURCESET_REFERENCE) |
| 497 | 497 | || ($resourcePropertyKind == ResourcePropertyKind::KEY_RESOURCE_REFERENCE)' |
| 498 | - ); |
|
| 498 | + ); |
|
| 499 | 499 | |
| 500 | 500 | $navigationProperties[$i] = new NavigationPropertyInfo($resourceProperty, $this->shouldExpandSegment($resourceProperty->getName())); |
| 501 | 501 | if ($navigationProperties[$i]->expanded) { |
@@ -617,10 +617,10 @@ discard block |
||
| 617 | 617 | $currentResourceType1 = $currentResourceSetWrapper->getResourceType(); |
| 618 | 618 | |
| 619 | 619 | $link->expandedResult = $this->_writeEntryElement( |
| 620 | - $navigationPropertyInfo->value, |
|
| 621 | - $currentResourceType1, |
|
| 622 | - $propertyAbsoluteUri, |
|
| 623 | - $propertyRelativeUri |
|
| 620 | + $navigationPropertyInfo->value, |
|
| 621 | + $currentResourceType1, |
|
| 622 | + $propertyAbsoluteUri, |
|
| 623 | + $propertyRelativeUri |
|
| 624 | 624 | ); |
| 625 | 625 | } |
| 626 | 626 | } else { |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | public function writeTopLevelComplexObject( |
| 193 | 193 | &$complexValue, |
| 194 | 194 | $propertyName, |
| 195 | - ResourceType &$resourceType |
|
| 195 | + ResourceType & $resourceType |
|
| 196 | 196 | ) { |
| 197 | 197 | $propertyContent = new ODataPropertyContent(); |
| 198 | 198 | $this->_writeComplexValue( |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | public function writeTopLevelBagObject( |
| 220 | 220 | &$BagValue, |
| 221 | 221 | $propertyName, |
| 222 | - ResourceType &$resourceType |
|
| 222 | + ResourceType & $resourceType |
|
| 223 | 223 | ) { |
| 224 | 224 | |
| 225 | 225 | $propertyContent = new ODataPropertyContent(); |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | */ |
| 247 | 247 | public function writeTopLevelPrimitive( |
| 248 | 248 | &$primitiveValue, |
| 249 | - ResourceProperty &$resourceProperty |
|
| 249 | + ResourceProperty & $resourceProperty |
|
| 250 | 250 | ) { |
| 251 | 251 | $propertyContent = new ODataPropertyContent(); |
| 252 | 252 | $propertyContent->properties[] = new ODataProperty(); |
@@ -335,18 +335,18 @@ discard block |
||
| 335 | 335 | */ |
| 336 | 336 | private function _writeFeedElements( |
| 337 | 337 | &$entryObjects, |
| 338 | - ResourceType &$resourceType, |
|
| 338 | + ResourceType & $resourceType, |
|
| 339 | 339 | $title, |
| 340 | 340 | $absoluteUri, |
| 341 | 341 | $relativeUri, |
| 342 | - ODataFeed &$feed |
|
| 342 | + ODataFeed & $feed |
|
| 343 | 343 | ) { |
| 344 | 344 | $this->assert(is_array($entryObjects) || $entryObjects instanceof ArrayAccess, '_writeFeedElements::is_array($entryObjects)'); |
| 345 | 345 | $feed->id = $absoluteUri; |
| 346 | 346 | $feed->title = $title; |
| 347 | 347 | $feed->selfLink = new ODataLink(); |
| 348 | 348 | $feed->selfLink->name = ODataConstants::ATOM_SELF_RELATION_ATTRIBUTE_VALUE; |
| 349 | - $feed->selfLink->title = $title; |
|
| 349 | + $feed->selfLink->title = $title; |
|
| 350 | 350 | $feed->selfLink->url = $relativeUri; |
| 351 | 351 | |
| 352 | 352 | if (empty($entryObjects)) { |
@@ -391,11 +391,11 @@ discard block |
||
| 391 | 391 | */ |
| 392 | 392 | private function _writeObjectProperties( |
| 393 | 393 | $customObject, |
| 394 | - ResourceType &$resourceType, |
|
| 394 | + ResourceType & $resourceType, |
|
| 395 | 395 | $absoluteUri, |
| 396 | 396 | $relativeUri, |
| 397 | 397 | &$odataEntry, |
| 398 | - ODataPropertyContent &$odataPropertyContent |
|
| 398 | + ODataPropertyContent & $odataPropertyContent |
|
| 399 | 399 | ) { |
| 400 | 400 | $resourceTypeKind = $resourceType->getResourceTypeKind(); |
| 401 | 401 | if (is_null($absoluteUri) == ($resourceTypeKind == ResourceTypeKind::ENTITY) |
@@ -573,8 +573,7 @@ discard block |
||
| 573 | 573 | foreach ($navigationProperties as $navigationPropertyInfo) { |
| 574 | 574 | $propertyName = $navigationPropertyInfo->resourceProperty->getName(); |
| 575 | 575 | $type = $navigationPropertyInfo->resourceProperty->getKind() == ResourcePropertyKind::RESOURCE_REFERENCE ? |
| 576 | - 'application/atom+xml;type=entry': |
|
| 577 | - 'application/atom+xml;type=feed'; |
|
| 576 | + 'application/atom+xml;type=entry' : 'application/atom+xml;type=feed'; |
|
| 578 | 577 | $link = new ODataLink(); |
| 579 | 578 | $link->name = ODataConstants::ODATA_RELATED_NAMESPACE . $propertyName; |
| 580 | 579 | $link->title = $propertyName; |
@@ -651,7 +650,7 @@ discard block |
||
| 651 | 650 | * @return void |
| 652 | 651 | */ |
| 653 | 652 | private function _writePrimitiveValue(&$primitiveValue, |
| 654 | - ResourceProperty &$resourceProperty, ODataProperty &$odataProperty |
|
| 653 | + ResourceProperty & $resourceProperty, ODataProperty & $odataProperty |
|
| 655 | 654 | ) { |
| 656 | 655 | if (is_object($primitiveValue)) { |
| 657 | 656 | //TODO ERROR: The property 'PropertyName' |
@@ -690,8 +689,8 @@ discard block |
||
| 690 | 689 | * @return void |
| 691 | 690 | */ |
| 692 | 691 | private function _writeComplexValue(&$complexValue, |
| 693 | - $propertyName, ResourceType &$resourceType, $relativeUri, |
|
| 694 | - ODataPropertyContent &$odataPropertyContent |
|
| 692 | + $propertyName, ResourceType & $resourceType, $relativeUri, |
|
| 693 | + ODataPropertyContent & $odataPropertyContent |
|
| 695 | 694 | ) { |
| 696 | 695 | $odataProperty = new ODataProperty(); |
| 697 | 696 | $odataProperty->name = $propertyName; |
@@ -730,8 +729,8 @@ discard block |
||
| 730 | 729 | * @return void |
| 731 | 730 | */ |
| 732 | 731 | private function _writeBagValue(&$BagValue, |
| 733 | - $propertyName, ResourceType &$resourceType, $relativeUri, |
|
| 734 | - ODataPropertyContent &$odataPropertyContent |
|
| 732 | + $propertyName, ResourceType & $resourceType, $relativeUri, |
|
| 733 | + ODataPropertyContent & $odataPropertyContent |
|
| 735 | 734 | ) { |
| 736 | 735 | $bagItemResourceTypeKind = $resourceType->getResourceTypeKind(); |
| 737 | 736 | $this->assert( |
@@ -743,7 +742,7 @@ discard block |
||
| 743 | 742 | |
| 744 | 743 | $odataProperty = new ODataProperty(); |
| 745 | 744 | $odataProperty->name = $propertyName; |
| 746 | - $odataProperty->typeName = 'Collection(' . $resourceType->getFullName() .')'; |
|
| 745 | + $odataProperty->typeName = 'Collection(' . $resourceType->getFullName() . ')'; |
|
| 747 | 746 | if (is_null($BagValue) || (is_array($BagValue) && empty ($BagValue))) { |
| 748 | 747 | $odataProperty->value = null; |
| 749 | 748 | } else { |
@@ -790,10 +789,10 @@ discard block |
||
| 790 | 789 | */ |
| 791 | 790 | private function _writeMediaResourceMetadata( |
| 792 | 791 | $entryObject, |
| 793 | - ResourceType &$resourceType, |
|
| 792 | + ResourceType & $resourceType, |
|
| 794 | 793 | $title, |
| 795 | 794 | $relativeUri, |
| 796 | - ODataEntry &$odataEntry |
|
| 795 | + ODataEntry & $odataEntry |
|
| 797 | 796 | ) { |
| 798 | 797 | if ($resourceType->isMediaLinkEntry()) { |
| 799 | 798 | $odataEntry->isMediaLinkEntry = true; |
@@ -839,7 +838,7 @@ discard block |
||
| 839 | 838 | * |
| 840 | 839 | * @return void |
| 841 | 840 | */ |
| 842 | - private function _primitiveToString(ResourceType &$primtiveResourceType, |
|
| 841 | + private function _primitiveToString(ResourceType & $primtiveResourceType, |
|
| 843 | 842 | $primitiveValue, &$stringValue |
| 844 | 843 | ) { |
| 845 | 844 | $type = $primtiveResourceType->getInstanceType(); |
@@ -876,8 +875,8 @@ discard block |
||
| 876 | 875 | * @return void |
| 877 | 876 | */ |
| 878 | 877 | private function _complexObjectToContent(&$complexValue, |
| 879 | - $propertyName, ResourceType &$resourceType, $relativeUri, |
|
| 880 | - ODataPropertyContent &$odataPropertyContent |
|
| 878 | + $propertyName, ResourceType & $resourceType, $relativeUri, |
|
| 879 | + ODataPropertyContent & $odataPropertyContent |
|
| 881 | 880 | ) { |
| 882 | 881 | $count = count($this->complexTypeInstanceCollection); |
| 883 | 882 | for ($i = 0; $i < $count; $i++) { |
@@ -422,7 +422,7 @@ discard block |
||
| 422 | 422 | * used for generating $skiptoken. |
| 423 | 423 | * @param string $absoluteUri Absolute response URI. |
| 424 | 424 | * |
| 425 | - * @return URI for the link for next page. |
|
| 425 | + * @return ODataLink for the link for next page. |
|
| 426 | 426 | */ |
| 427 | 427 | protected function getNextLinkUri(&$lastObject, $absoluteUri) |
| 428 | 428 | { |
@@ -635,6 +635,8 @@ discard block |
||
| 635 | 635 | * true if any expansion |
| 636 | 636 | * defined under this node |
| 637 | 637 | * false otherwise. |
| 638 | + * @param boolean $foundSelections |
|
| 639 | + * @param boolean $foundExpansions |
|
| 638 | 640 | * |
| 639 | 641 | * @return void |
| 640 | 642 | */ |
@@ -160,11 +160,11 @@ discard block |
||
| 160 | 160 | protected function getPropertyValue($entity, ResourceType $resourceType, ResourceProperty $resourceProperty) |
| 161 | 161 | { |
| 162 | 162 | try { |
| 163 | - //Is this slow? See #88 |
|
| 164 | - $reflectionClass = new \ReflectionClass(get_class($entity)); |
|
| 165 | - $reflectionProperty = $reflectionClass->getProperty($resourceProperty->getName()); |
|
| 166 | - $reflectionProperty->setAccessible(true); |
|
| 167 | - return $reflectionProperty->getValue($entity); |
|
| 163 | + //Is this slow? See #88 |
|
| 164 | + $reflectionClass = new \ReflectionClass(get_class($entity)); |
|
| 165 | + $reflectionProperty = $reflectionClass->getProperty($resourceProperty->getName()); |
|
| 166 | + $reflectionProperty->setAccessible(true); |
|
| 167 | + return $reflectionProperty->getValue($entity); |
|
| 168 | 168 | } catch (\ReflectionException $reflectionException) { |
| 169 | 169 | throw ODataException::createInternalServerError( |
| 170 | 170 | Messages::objectModelSerializerFailedToAccessProperty( |
@@ -561,7 +561,7 @@ discard block |
||
| 561 | 561 | //presence of $top option affect next link for root container |
| 562 | 562 | $topValueCount = $this->request->getTopOptionCount(); |
| 563 | 563 | if (!is_null($topValueCount) && ($topValueCount <= $pageSize)) { |
| 564 | - return false; |
|
| 564 | + return false; |
|
| 565 | 565 | } |
| 566 | 566 | } |
| 567 | 567 | |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | $keyValue = $keyType->convertToOData($keyValue); |
| 140 | - $keyString .= $comma . $keyName.'='.$keyValue; |
|
| 140 | + $keyString .= $comma . $keyName . '=' . $keyValue; |
|
| 141 | 141 | $comma = ','; |
| 142 | 142 | } |
| 143 | 143 | |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | ); |
| 226 | 226 | $value = $this->getPropertyValue($entryObject, $resourceType, $eTagProperty); |
| 227 | 227 | if (is_null($value)) { |
| 228 | - $eTag = $eTag . $comma. 'null'; |
|
| 228 | + $eTag = $eTag . $comma . 'null'; |
|
| 229 | 229 | } else { |
| 230 | 230 | $eTag = $eTag . $comma . $type->convertToOData($value); |
| 231 | 231 | } |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | * @throws InvalidOperationException If this function invoked with non-navigation |
| 274 | 274 | * property instance. |
| 275 | 275 | */ |
| 276 | - protected function pushSegmentForNavigationProperty(ResourceProperty &$resourceProperty) |
|
| 276 | + protected function pushSegmentForNavigationProperty(ResourceProperty & $resourceProperty) |
|
| 277 | 277 | { |
| 278 | 278 | if ($resourceProperty->getTypeKind() == ResourceTypeKind::ENTITY) { |
| 279 | 279 | $this->assert(!empty($this->_segmentNames), '!is_empty($this->_segmentNames'); |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | * |
| 387 | 387 | * @return bool true if the segment was push, false otherwise |
| 388 | 388 | */ |
| 389 | - private function _pushSegment($segmentName, ResourceSetWrapper &$resourceSetWrapper) |
|
| 389 | + private function _pushSegment($segmentName, ResourceSetWrapper & $resourceSetWrapper) |
|
| 390 | 390 | { |
| 391 | 391 | $rootProjectionNode = $this->request->getRootProjectionNode(); |
| 392 | 392 | // Even though there is no expand in the request URI, still we need to push |
@@ -474,7 +474,7 @@ discard block |
||
| 474 | 474 | |
| 475 | 475 | $topCountValue = $this->request->getTopOptionCount(); |
| 476 | 476 | if (!is_null($topCountValue)) { |
| 477 | - $remainingCount = $topCountValue - $this->request->getTopCount(); |
|
| 477 | + $remainingCount = $topCountValue - $this->request->getTopCount(); |
|
| 478 | 478 | if (!is_null($queryParameterString)) { |
| 479 | 479 | $queryParameterString .= '&'; |
| 480 | 480 | } |
@@ -640,7 +640,7 @@ discard block |
||
| 640 | 640 | */ |
| 641 | 641 | private function _buildSelectionAndExpansionPathsForNode(&$parentPathSegments, |
| 642 | 642 | &$selectionPaths, &$expansionPaths, |
| 643 | - ExpandedProjectionNode &$expandedProjectionNode, |
|
| 643 | + ExpandedProjectionNode & $expandedProjectionNode, |
|
| 644 | 644 | &$foundSelections, &$foundExpansions |
| 645 | 645 | ) { |
| 646 | 646 | $foundSelections = false; |
@@ -128,7 +128,9 @@ |
||
| 128 | 128 | $comma = null; |
| 129 | 129 | foreach ($keyProperties as $keyName => $resourceProperty) { |
| 130 | 130 | $keyType = $resourceProperty->getInstanceType(); |
| 131 | - if (!$keyType instanceof IType) continue; |
|
| 131 | + if (!$keyType instanceof IType) { |
|
| 132 | + continue; |
|
| 133 | + } |
|
| 132 | 134 | // $this->assert($keyType instanceof IType, '$keyType instanceof IType'); |
| 133 | 135 | |
| 134 | 136 | $keyValue = $this->getPropertyValue($entityInstance, $resourceType, $resourceProperty); |