@@ -29,7 +29,7 @@ |
||
| 29 | 29 | * @param string $statusCode The status code |
| 30 | 30 | * @param string $errorCode The error code |
| 31 | 31 | * |
| 32 | - * @return void |
|
| 32 | + * @return ODataException |
|
| 33 | 33 | */ |
| 34 | 34 | public function __construct($message, $statusCode, $errorCode= null) |
| 35 | 35 | { |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | * |
| 32 | 32 | * @return void |
| 33 | 33 | */ |
| 34 | - public function __construct($message, $statusCode, $errorCode= null) |
|
| 34 | + public function __construct($message, $statusCode, $errorCode = null) |
|
| 35 | 35 | { |
| 36 | 36 | $this->_errorCode = $errorCode; |
| 37 | 37 | $this->_statusCode = $statusCode; |
@@ -463,7 +463,7 @@ discard block |
||
| 463 | 463 | * To check whether the given character is a HTTP token character |
| 464 | 464 | * or not. |
| 465 | 465 | * |
| 466 | - * @param char $char The character to inspect. |
|
| 466 | + * @param string $char The character to inspect. |
|
| 467 | 467 | * |
| 468 | 468 | * @return boolean True if the given character is a valid HTTP token |
| 469 | 469 | * character, False otherwise. |
@@ -606,6 +606,7 @@ discard block |
||
| 606 | 606 | * @param string $text Text to read qvalue from. |
| 607 | 607 | * @param int &$textIndex Index into text where the qvalue starts. |
| 608 | 608 | * @param int &$qualityValue After the method executes, the normalized qvalue. |
| 609 | + * @param integer $textIndex |
|
| 609 | 610 | * |
| 610 | 611 | * @throws HttpHeaderFailure If any error occured while reading and processing |
| 611 | 612 | * the quality factor. |
@@ -659,7 +660,7 @@ discard block |
||
| 659 | 660 | /** |
| 660 | 661 | * Converts the specified character from the ASCII range to a digit. |
| 661 | 662 | * |
| 662 | - * @param char $c Character to convert |
|
| 663 | + * @param string $c Character to convert |
|
| 663 | 664 | * |
| 664 | 665 | * @return int The Int32 value for $c, or -1 if it is an element separator. |
| 665 | 666 | * |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | //the rest look like QSPs..kinda so we can do this |
| 104 | 104 | parse_str(implode("&", $candidateParts), $candidateParts); |
| 105 | 105 | if(array_key_exists('odata', $candidateParts)){ |
| 106 | - $candidateODataValue = $candidateParts['odata']; |
|
| 106 | + $candidateODataValue = $candidateParts['odata']; |
|
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | 109 | |
@@ -697,7 +697,7 @@ discard block |
||
| 697 | 697 | } |
| 698 | 698 | |
| 699 | 699 | |
| 700 | - public static function headerToServerKey($headerName){ |
|
| 701 | - return 'HTTP_' . strtoupper(str_replace('-', '_', $headerName)); |
|
| 702 | - } |
|
| 700 | + public static function headerToServerKey($headerName){ |
|
| 701 | + return 'HTTP_' . strtoupper(str_replace('-', '_', $headerName)); |
|
| 702 | + } |
|
| 703 | 703 | } |
| 704 | 704 | \ No newline at end of file |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | */ |
| 64 | 64 | public function getMimeType() |
| 65 | 65 | { |
| 66 | - return $this->_type . '/' . $this->_subType; |
|
| 66 | + return $this->_type.'/'.$this->_subType; |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | /** |
@@ -97,18 +97,18 @@ discard block |
||
| 97 | 97 | //get the odata parameter (if there is one) |
| 98 | 98 | $candidateODataValue = null; |
| 99 | 99 | $candidateParts = explode(';', $candidate); |
| 100 | - if(count($candidateParts) > 1){ |
|
| 100 | + if (count($candidateParts) > 1) { |
|
| 101 | 101 | //is it safe to assume the mime type is always the first part? |
| 102 | 102 | $candidate = array_shift($candidateParts); //move off the first type matcher |
| 103 | 103 | //the rest look like QSPs..kinda so we can do this |
| 104 | 104 | parse_str(implode("&", $candidateParts), $candidateParts); |
| 105 | - if(array_key_exists('odata', $candidateParts)){ |
|
| 105 | + if (array_key_exists('odata', $candidateParts)) { |
|
| 106 | 106 | $candidateODataValue = $candidateParts['odata']; |
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | //ensure that the odata parameter values match |
| 111 | - if($this->getODataValue() !== $candidateODataValue){ |
|
| 111 | + if ($this->getODataValue() !== $candidateODataValue) { |
|
| 112 | 112 | return -1; |
| 113 | 113 | } |
| 114 | 114 | |
@@ -697,7 +697,7 @@ discard block |
||
| 697 | 697 | } |
| 698 | 698 | |
| 699 | 699 | |
| 700 | - public static function headerToServerKey($headerName){ |
|
| 701 | - return 'HTTP_' . strtoupper(str_replace('-', '_', $headerName)); |
|
| 700 | + public static function headerToServerKey($headerName) { |
|
| 701 | + return 'HTTP_'.strtoupper(str_replace('-', '_', $headerName)); |
|
| 702 | 702 | } |
| 703 | 703 | } |
| 704 | 704 | \ No newline at end of file |
@@ -376,7 +376,7 @@ |
||
| 376 | 376 | * NULL for complex object. |
| 377 | 377 | * @param string $relativeUri Relative uri for the given |
| 378 | 378 | * custom object. |
| 379 | - * @param ODataEntry &$odataEntry ODataEntry instance to |
|
| 379 | + * @param ODataEntry ODataEntry|null ODataEntry instance to |
|
| 380 | 380 | * place links and |
| 381 | 381 | * expansion of the |
| 382 | 382 | * entry object, |
@@ -12,10 +12,8 @@ |
||
| 12 | 12 | use POData\Providers\Metadata\ResourceTypeKind; |
| 13 | 13 | use POData\Providers\Metadata\ResourcePropertyKind; |
| 14 | 14 | use POData\Providers\Metadata\ResourceProperty; |
| 15 | -use POData\Providers\ProvidersWrapper; |
|
| 16 | 15 | use POData\Providers\Metadata\Type\Binary; |
| 17 | 16 | use POData\Providers\Metadata\Type\Boolean; |
| 18 | -use POData\Providers\Metadata\Type\String; |
|
| 19 | 17 | use POData\Providers\Metadata\Type\DateTime; |
| 20 | 18 | use POData\Common\ODataException; |
| 21 | 19 | use POData\Common\Messages; |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | $needPop = $this->pushSegmentForRoot(); |
| 67 | 67 | $entry = $this->_writeEntryElement( |
| 68 | 68 | $entryObject, |
| 69 | - $resourceType, |
|
| 69 | + $resourceType, |
|
| 70 | 70 | $this->request->getRequestUrl()->getUrlAsString(), |
| 71 | 71 | $this->request->getContainerName() |
| 72 | 72 | ); |
@@ -189,18 +189,18 @@ discard block |
||
| 189 | 189 | * @return ODataPropertyContent |
| 190 | 190 | */ |
| 191 | 191 | public function writeTopLevelComplexObject( |
| 192 | - &$complexValue, |
|
| 192 | + &$complexValue, |
|
| 193 | 193 | $propertyName, |
| 194 | 194 | ResourceType &$resourceType |
| 195 | 195 | ) { |
| 196 | - $propertyContent = new ODataPropertyContent(); |
|
| 196 | + $propertyContent = new ODataPropertyContent(); |
|
| 197 | 197 | $this->_writeComplexValue( |
| 198 | 198 | $complexValue, |
| 199 | 199 | $propertyName, $resourceType, null, |
| 200 | - $propertyContent |
|
| 200 | + $propertyContent |
|
| 201 | 201 | ); |
| 202 | 202 | |
| 203 | - return $propertyContent; |
|
| 203 | + return $propertyContent; |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | /** |
@@ -216,19 +216,19 @@ discard block |
||
| 216 | 216 | * @return ODataPropertyContent |
| 217 | 217 | */ |
| 218 | 218 | public function writeTopLevelBagObject( |
| 219 | - &$BagValue, |
|
| 219 | + &$BagValue, |
|
| 220 | 220 | $propertyName, |
| 221 | 221 | ResourceType &$resourceType |
| 222 | 222 | ) { |
| 223 | 223 | |
| 224 | - $propertyContent = new ODataPropertyContent(); |
|
| 224 | + $propertyContent = new ODataPropertyContent(); |
|
| 225 | 225 | $this->_writeBagValue( |
| 226 | 226 | $BagValue, |
| 227 | 227 | $propertyName, $resourceType, null, |
| 228 | - $propertyContent |
|
| 228 | + $propertyContent |
|
| 229 | 229 | ); |
| 230 | 230 | |
| 231 | - return $propertyContent; |
|
| 231 | + return $propertyContent; |
|
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | /** |
@@ -244,18 +244,18 @@ discard block |
||
| 244 | 244 | * @return ODataPropertyContent |
| 245 | 245 | */ |
| 246 | 246 | public function writeTopLevelPrimitive( |
| 247 | - &$primitiveValue, |
|
| 247 | + &$primitiveValue, |
|
| 248 | 248 | ResourceProperty &$resourceProperty |
| 249 | 249 | ) { |
| 250 | - $propertyContent = new ODataPropertyContent(); |
|
| 251 | - $propertyContent->properties[] = new ODataProperty(); |
|
| 250 | + $propertyContent = new ODataPropertyContent(); |
|
| 251 | + $propertyContent->properties[] = new ODataProperty(); |
|
| 252 | 252 | $this->_writePrimitiveValue( |
| 253 | 253 | $primitiveValue, |
| 254 | 254 | $resourceProperty, |
| 255 | - $propertyContent->properties[0] |
|
| 255 | + $propertyContent->properties[0] |
|
| 256 | 256 | ); |
| 257 | 257 | |
| 258 | - return $propertyContent; |
|
| 258 | + return $propertyContent; |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | /** |
@@ -274,8 +274,8 @@ discard block |
||
| 274 | 274 | $absoluteUri, |
| 275 | 275 | $relativeUri |
| 276 | 276 | ) { |
| 277 | - $entry = new ODataEntry(); |
|
| 278 | - $entry->resourceSetName = $this->getCurrentResourceSetWrapper()->getName(); |
|
| 277 | + $entry = new ODataEntry(); |
|
| 278 | + $entry->resourceSetName = $this->getCurrentResourceSetWrapper()->getName(); |
|
| 279 | 279 | |
| 280 | 280 | if (is_null($entryObject)) { |
| 281 | 281 | //According to atom standard an empty entry must have an Author |
@@ -296,27 +296,27 @@ discard block |
||
| 296 | 296 | $actualResourceType, |
| 297 | 297 | $title, |
| 298 | 298 | $relativeUri, |
| 299 | - $entry |
|
| 299 | + $entry |
|
| 300 | 300 | ); |
| 301 | 301 | |
| 302 | - $entry->id = $absoluteUri; |
|
| 303 | - $entry->eTag = $this->getETagForEntry($entryObject, $resourceType); |
|
| 304 | - $entry->title = $title; |
|
| 305 | - $entry->editLink = $relativeUri; |
|
| 306 | - $entry->type = $actualResourceType->getFullName(); |
|
| 302 | + $entry->id = $absoluteUri; |
|
| 303 | + $entry->eTag = $this->getETagForEntry($entryObject, $resourceType); |
|
| 304 | + $entry->title = $title; |
|
| 305 | + $entry->editLink = $relativeUri; |
|
| 306 | + $entry->type = $actualResourceType->getFullName(); |
|
| 307 | 307 | $odataPropertyContent = new ODataPropertyContent(); |
| 308 | 308 | $this->_writeObjectProperties( |
| 309 | 309 | $entryObject, |
| 310 | 310 | $actualResourceType, |
| 311 | 311 | $absoluteUri, |
| 312 | 312 | $relativeUri, |
| 313 | - $entry, |
|
| 313 | + $entry, |
|
| 314 | 314 | $odataPropertyContent |
| 315 | 315 | ); |
| 316 | - $entry->propertyContent = $odataPropertyContent; |
|
| 316 | + $entry->propertyContent = $odataPropertyContent; |
|
| 317 | 317 | } |
| 318 | 318 | |
| 319 | - return $entry; |
|
| 319 | + return $entry; |
|
| 320 | 320 | } |
| 321 | 321 | |
| 322 | 322 | /** |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | * @return void |
| 389 | 389 | */ |
| 390 | 390 | private function _writeObjectProperties( |
| 391 | - $customObject, |
|
| 391 | + $customObject, |
|
| 392 | 392 | ResourceType &$resourceType, |
| 393 | 393 | $absoluteUri, |
| 394 | 394 | $relativeUri, |
@@ -486,12 +486,12 @@ discard block |
||
| 486 | 486 | ) { |
| 487 | 487 | continue; |
| 488 | 488 | } else { |
| 489 | - $this->assert( |
|
| 490 | - ($resourcePropertyKind == ResourcePropertyKind::RESOURCE_REFERENCE) |
|
| 489 | + $this->assert( |
|
| 490 | + ($resourcePropertyKind == ResourcePropertyKind::RESOURCE_REFERENCE) |
|
| 491 | 491 | || ($resourcePropertyKind == ResourcePropertyKind::RESOURCESET_REFERENCE), |
| 492 | - '($resourcePropertyKind == ResourcePropertyKind::RESOURCE_REFERENCE) |
|
| 492 | + '($resourcePropertyKind == ResourcePropertyKind::RESOURCE_REFERENCE) |
|
| 493 | 493 | || ($resourcePropertyKind == ResourcePropertyKind::RESOURCESET_REFERENCE)' |
| 494 | - ); |
|
| 494 | + ); |
|
| 495 | 495 | |
| 496 | 496 | $navigationProperties[$i] = new NavigationPropertyInfo($resourceProperty, $this->shouldExpandSegment($resourceProperty->getName())); |
| 497 | 497 | if ($navigationProperties[$i]->expanded) { |
@@ -611,10 +611,10 @@ discard block |
||
| 611 | 611 | $currentResourceType1 = $currentResourceSetWrapper->getResourceType(); |
| 612 | 612 | |
| 613 | 613 | $link->expandedResult = $this->_writeEntryElement( |
| 614 | - $navigationPropertyInfo->value, |
|
| 615 | - $currentResourceType1, |
|
| 616 | - $propertyAbsoluteUri, |
|
| 617 | - $propertyRelativeUri |
|
| 614 | + $navigationPropertyInfo->value, |
|
| 615 | + $currentResourceType1, |
|
| 616 | + $propertyAbsoluteUri, |
|
| 617 | + $propertyRelativeUri |
|
| 618 | 618 | ); |
| 619 | 619 | } |
| 620 | 620 | } else { |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | $this->getCurrentResourceSetWrapper()->getName() |
| 141 | 141 | ); |
| 142 | 142 | |
| 143 | - $url->url = rtrim($this->absoluteServiceUri, '/') . '/' . $relativeUri; |
|
| 143 | + $url->url = rtrim($this->absoluteServiceUri, '/').'/'.$relativeUri; |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | return $url; |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | public function writeTopLevelComplexObject( |
| 192 | 192 | &$complexValue, |
| 193 | 193 | $propertyName, |
| 194 | - ResourceType &$resourceType |
|
| 194 | + ResourceType & $resourceType |
|
| 195 | 195 | ) { |
| 196 | 196 | $propertyContent = new ODataPropertyContent(); |
| 197 | 197 | $this->_writeComplexValue( |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | public function writeTopLevelBagObject( |
| 219 | 219 | &$BagValue, |
| 220 | 220 | $propertyName, |
| 221 | - ResourceType &$resourceType |
|
| 221 | + ResourceType & $resourceType |
|
| 222 | 222 | ) { |
| 223 | 223 | |
| 224 | 224 | $propertyContent = new ODataPropertyContent(); |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | */ |
| 246 | 246 | public function writeTopLevelPrimitive( |
| 247 | 247 | &$primitiveValue, |
| 248 | - ResourceProperty &$resourceProperty |
|
| 248 | + ResourceProperty & $resourceProperty |
|
| 249 | 249 | ) { |
| 250 | 250 | $propertyContent = new ODataPropertyContent(); |
| 251 | 251 | $propertyContent->properties[] = new ODataProperty(); |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | $this->getCurrentResourceSetWrapper()->getName() |
| 288 | 288 | ); |
| 289 | 289 | |
| 290 | - $absoluteUri = rtrim($this->absoluteServiceUri, '/') . '/' . $relativeUri; |
|
| 290 | + $absoluteUri = rtrim($this->absoluteServiceUri, '/').'/'.$relativeUri; |
|
| 291 | 291 | $title = $resourceType->getName(); |
| 292 | 292 | //TODO Resolve actual resource type |
| 293 | 293 | $actualResourceType = $resourceType; |
@@ -334,18 +334,18 @@ discard block |
||
| 334 | 334 | */ |
| 335 | 335 | private function _writeFeedElements( |
| 336 | 336 | &$entryObjects, |
| 337 | - ResourceType &$resourceType, |
|
| 337 | + ResourceType & $resourceType, |
|
| 338 | 338 | $title, |
| 339 | 339 | $absoluteUri, |
| 340 | 340 | $relativeUri, |
| 341 | - ODataFeed &$feed |
|
| 341 | + ODataFeed & $feed |
|
| 342 | 342 | ) { |
| 343 | 343 | $this->assert(is_array($entryObjects), '_writeFeedElements::is_array($entryObjects)'); |
| 344 | 344 | $feed->id = $absoluteUri; |
| 345 | 345 | $feed->title = $title; |
| 346 | 346 | $feed->selfLink = new ODataLink(); |
| 347 | 347 | $feed->selfLink->name = ODataConstants::ATOM_SELF_RELATION_ATTRIBUTE_VALUE; |
| 348 | - $feed->selfLink->title = $title; |
|
| 348 | + $feed->selfLink->title = $title; |
|
| 349 | 349 | $feed->selfLink->url = $relativeUri; |
| 350 | 350 | |
| 351 | 351 | if (empty($entryObjects)) { |
@@ -389,11 +389,11 @@ discard block |
||
| 389 | 389 | */ |
| 390 | 390 | private function _writeObjectProperties( |
| 391 | 391 | $customObject, |
| 392 | - ResourceType &$resourceType, |
|
| 392 | + ResourceType & $resourceType, |
|
| 393 | 393 | $absoluteUri, |
| 394 | 394 | $relativeUri, |
| 395 | 395 | &$odataEntry, |
| 396 | - ODataPropertyContent &$odataPropertyContent |
|
| 396 | + ODataPropertyContent & $odataPropertyContent |
|
| 397 | 397 | ) { |
| 398 | 398 | $resourceTypeKind = $resourceType->getResourceTypeKind(); |
| 399 | 399 | if (is_null($absoluteUri) == ($resourceTypeKind == ResourceTypeKind::ENTITY) |
@@ -464,7 +464,7 @@ discard block |
||
| 464 | 464 | $propertyValue, |
| 465 | 465 | $resourceProperty->getName(), |
| 466 | 466 | $resourceType2, |
| 467 | - $relativeUri . '/' . $resourceProperty->getName(), |
|
| 467 | + $relativeUri.'/'.$resourceProperty->getName(), |
|
| 468 | 468 | $odataPropertyContent |
| 469 | 469 | ); |
| 470 | 470 | } else { |
@@ -476,7 +476,7 @@ discard block |
||
| 476 | 476 | $propertyValue, |
| 477 | 477 | $resourceProperty->getName(), |
| 478 | 478 | $resourceType1, |
| 479 | - $relativeUri . '/' . $resourceProperty->getName(), |
|
| 479 | + $relativeUri.'/'.$resourceProperty->getName(), |
|
| 480 | 480 | $odataPropertyContent |
| 481 | 481 | ); |
| 482 | 482 | } else if ($resourceProperty->getKind() == ResourcePropertyKind::PRIMITIVE |
@@ -541,7 +541,7 @@ discard block |
||
| 541 | 541 | $propertyValue, |
| 542 | 542 | $propertyName, |
| 543 | 543 | $bagResourceType, |
| 544 | - $relativeUri . '/' . $propertyName, |
|
| 544 | + $relativeUri.'/'.$propertyName, |
|
| 545 | 545 | $odataPropertyContent |
| 546 | 546 | ); |
| 547 | 547 | } else if (ResourceProperty::sIsKindOf($propertyTypeKind, ResourcePropertyKind::PRIMITIVE)) { |
@@ -554,7 +554,7 @@ discard block |
||
| 554 | 554 | $propertyValue, |
| 555 | 555 | $propertyName, |
| 556 | 556 | $complexResourceType, |
| 557 | - $relativeUri . '/' . $propertyName, |
|
| 557 | + $relativeUri.'/'.$propertyName, |
|
| 558 | 558 | $odataPropertyContent |
| 559 | 559 | ); |
| 560 | 560 | } else { |
@@ -569,17 +569,16 @@ discard block |
||
| 569 | 569 | foreach ($navigationProperties as $navigationPropertyInfo) { |
| 570 | 570 | $propertyName = $navigationPropertyInfo->resourceProperty->getName(); |
| 571 | 571 | $type = $navigationPropertyInfo->resourceProperty->getKind() == ResourcePropertyKind::RESOURCE_REFERENCE ? |
| 572 | - 'application/atom+xml;type=entry': |
|
| 573 | - 'application/atom+xml;type=feed'; |
|
| 572 | + 'application/atom+xml;type=entry' : 'application/atom+xml;type=feed'; |
|
| 574 | 573 | $link = new ODataLink(); |
| 575 | - $link->name = ODataConstants::ODATA_RELATED_NAMESPACE . $propertyName; |
|
| 574 | + $link->name = ODataConstants::ODATA_RELATED_NAMESPACE.$propertyName; |
|
| 576 | 575 | $link->title = $propertyName; |
| 577 | 576 | $link->type = $type; |
| 578 | - $link->url = $relativeUri . '/' . $propertyName; |
|
| 577 | + $link->url = $relativeUri.'/'.$propertyName; |
|
| 579 | 578 | |
| 580 | 579 | if ($navigationPropertyInfo->expanded) { |
| 581 | - $propertyRelativeUri = $relativeUri . '/' . $propertyName; |
|
| 582 | - $propertyAbsoluteUri = trim($absoluteUri, '/') . '/' . $propertyName; |
|
| 580 | + $propertyRelativeUri = $relativeUri.'/'.$propertyName; |
|
| 581 | + $propertyAbsoluteUri = trim($absoluteUri, '/').'/'.$propertyName; |
|
| 583 | 582 | $needPop = $this->pushSegmentForNavigationProperty($navigationPropertyInfo->resourceProperty); |
| 584 | 583 | $navigationPropertyKind = $navigationPropertyInfo->resourceProperty->getKind(); |
| 585 | 584 | $this->assert( |
@@ -645,7 +644,7 @@ discard block |
||
| 645 | 644 | * @return void |
| 646 | 645 | */ |
| 647 | 646 | private function _writePrimitiveValue(&$primitiveValue, |
| 648 | - ResourceProperty &$resourceProperty, ODataProperty &$odataProperty |
|
| 647 | + ResourceProperty & $resourceProperty, ODataProperty & $odataProperty |
|
| 649 | 648 | ) { |
| 650 | 649 | if (is_object($primitiveValue)) { |
| 651 | 650 | //TODO ERROR: The property 'PropertyName' |
@@ -684,8 +683,8 @@ discard block |
||
| 684 | 683 | * @return void |
| 685 | 684 | */ |
| 686 | 685 | private function _writeComplexValue(&$complexValue, |
| 687 | - $propertyName, ResourceType &$resourceType, $relativeUri, |
|
| 688 | - ODataPropertyContent &$odataPropertyContent |
|
| 686 | + $propertyName, ResourceType & $resourceType, $relativeUri, |
|
| 687 | + ODataPropertyContent & $odataPropertyContent |
|
| 689 | 688 | ) { |
| 690 | 689 | $odataProperty = new ODataProperty(); |
| 691 | 690 | $odataProperty->name = $propertyName; |
@@ -724,8 +723,8 @@ discard block |
||
| 724 | 723 | * @return void |
| 725 | 724 | */ |
| 726 | 725 | private function _writeBagValue(&$BagValue, |
| 727 | - $propertyName, ResourceType &$resourceType, $relativeUri, |
|
| 728 | - ODataPropertyContent &$odataPropertyContent |
|
| 726 | + $propertyName, ResourceType & $resourceType, $relativeUri, |
|
| 727 | + ODataPropertyContent & $odataPropertyContent |
|
| 729 | 728 | ) { |
| 730 | 729 | $bagItemResourceTypeKind = $resourceType->getResourceTypeKind(); |
| 731 | 730 | $this->assert( |
@@ -737,7 +736,7 @@ discard block |
||
| 737 | 736 | |
| 738 | 737 | $odataProperty = new ODataProperty(); |
| 739 | 738 | $odataProperty->name = $propertyName; |
| 740 | - $odataProperty->typeName = 'Collection(' . $resourceType->getFullName() .')'; |
|
| 739 | + $odataProperty->typeName = 'Collection('.$resourceType->getFullName().')'; |
|
| 741 | 740 | if (is_null($BagValue) || (is_array($BagValue) && empty ($BagValue))) { |
| 742 | 741 | $odataProperty->value = null; |
| 743 | 742 | } else { |
@@ -784,10 +783,10 @@ discard block |
||
| 784 | 783 | */ |
| 785 | 784 | private function _writeMediaResourceMetadata( |
| 786 | 785 | $entryObject, |
| 787 | - ResourceType &$resourceType, |
|
| 786 | + ResourceType & $resourceType, |
|
| 788 | 787 | $title, |
| 789 | 788 | $relativeUri, |
| 790 | - ODataEntry &$odataEntry |
|
| 789 | + ODataEntry & $odataEntry |
|
| 791 | 790 | ) { |
| 792 | 791 | if ($resourceType->isMediaLinkEntry()) { |
| 793 | 792 | $odataEntry->isMediaLinkEntry = true; |
@@ -833,7 +832,7 @@ discard block |
||
| 833 | 832 | * |
| 834 | 833 | * @return void |
| 835 | 834 | */ |
| 836 | - private function _primitiveToString(ResourceType &$primtiveResourceType, |
|
| 835 | + private function _primitiveToString(ResourceType & $primtiveResourceType, |
|
| 837 | 836 | $primitiveValue, &$stringValue |
| 838 | 837 | ) { |
| 839 | 838 | $type = $primtiveResourceType->getInstanceType(); |
@@ -868,8 +867,8 @@ discard block |
||
| 868 | 867 | * @return void |
| 869 | 868 | */ |
| 870 | 869 | private function _complexObjectToContent(&$complexValue, |
| 871 | - $propertyName, ResourceType &$resourceType, $relativeUri, |
|
| 872 | - ODataPropertyContent &$odataPropertyContent |
|
| 870 | + $propertyName, ResourceType & $resourceType, $relativeUri, |
|
| 871 | + ODataPropertyContent & $odataPropertyContent |
|
| 873 | 872 | ) { |
| 874 | 873 | $count = count($this->complexTypeInstanceCollection); |
| 875 | 874 | for ($i = 0; $i < $count; $i++) { |
@@ -419,7 +419,7 @@ discard block |
||
| 419 | 419 | * used for generating $skiptoken. |
| 420 | 420 | * @param string $absoluteUri Absolute response URI. |
| 421 | 421 | * |
| 422 | - * @return URI for the link for next page. |
|
| 422 | + * @return ODataLink for the link for next page. |
|
| 423 | 423 | */ |
| 424 | 424 | protected function getNextLinkUri(&$lastObject, $absoluteUri) |
| 425 | 425 | { |
@@ -632,6 +632,8 @@ discard block |
||
| 632 | 632 | * true if any expansion |
| 633 | 633 | * defined under this node |
| 634 | 634 | * false otherwise. |
| 635 | + * @param boolean $foundSelections |
|
| 636 | + * @param boolean $foundExpansions |
|
| 635 | 637 | * |
| 636 | 638 | * @return void |
| 637 | 639 | */ |
@@ -5,7 +5,6 @@ |
||
| 5 | 5 | |
| 6 | 6 | use POData\Common\ODataConstants; |
| 7 | 7 | use POData\IService; |
| 8 | -use POData\Providers\ProvidersWrapper; |
|
| 9 | 8 | use POData\Providers\Metadata\ResourceSetWrapper; |
| 10 | 9 | use POData\Providers\Metadata\ResourceProperty; |
| 11 | 10 | use POData\Providers\Metadata\ResourceTypeKind; |
@@ -159,9 +159,9 @@ discard block |
||
| 159 | 159 | protected function getPropertyValue($entity, ResourceType $resourceType, ResourceProperty $resourceProperty) |
| 160 | 160 | { |
| 161 | 161 | try { |
| 162 | - //Is this slow? See #88 |
|
| 163 | - $reflectionProperty = new \ReflectionProperty($entity, $resourceProperty->getName()); |
|
| 164 | - return $reflectionProperty->getValue($entity); |
|
| 162 | + //Is this slow? See #88 |
|
| 163 | + $reflectionProperty = new \ReflectionProperty($entity, $resourceProperty->getName()); |
|
| 164 | + return $reflectionProperty->getValue($entity); |
|
| 165 | 165 | } catch (\ReflectionException $reflectionException) { |
| 166 | 166 | throw ODataException::createInternalServerError( |
| 167 | 167 | Messages::objectModelSerializerFailedToAccessProperty( |
@@ -558,7 +558,7 @@ discard block |
||
| 558 | 558 | //presence of $top option affect next link for root container |
| 559 | 559 | $topValueCount = $this->request->getTopOptionCount(); |
| 560 | 560 | if (!is_null($topValueCount) && ($topValueCount <= $pageSize)) { |
| 561 | - return false; |
|
| 561 | + return false; |
|
| 562 | 562 | } |
| 563 | 563 | } |
| 564 | 564 | |
@@ -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->_segmentNames = array(); |
| 101 | 101 | $this->_segmentResourceSetWrappers = array(); |
| 102 | 102 | $this->_segmentResultCounts = array(); |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | { |
| 125 | 125 | $keyProperties = $resourceType->getKeyProperties(); |
| 126 | 126 | $this->assert(count($keyProperties) != 0, 'count($keyProperties) != 0'); |
| 127 | - $keyString = $containerName . '('; |
|
| 127 | + $keyString = $containerName.'('; |
|
| 128 | 128 | $comma = null; |
| 129 | 129 | foreach ($keyProperties as $keyName => $resourceProperty) { |
| 130 | 130 | $keyType = $resourceProperty->getInstanceType(); |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | $keyValue = $keyType->convertToOData($keyValue); |
| 139 | - $keyString .= $comma . $keyName.'='.$keyValue; |
|
| 139 | + $keyString .= $comma.$keyName.'='.$keyValue; |
|
| 140 | 140 | $comma = ','; |
| 141 | 141 | } |
| 142 | 142 | |
@@ -222,9 +222,9 @@ discard block |
||
| 222 | 222 | ); |
| 223 | 223 | $value = $this->getPropertyValue($entryObject, $resourceType, $eTagProperty); |
| 224 | 224 | if (is_null($value)) { |
| 225 | - $eTag = $eTag . $comma. 'null'; |
|
| 225 | + $eTag = $eTag.$comma.'null'; |
|
| 226 | 226 | } else { |
| 227 | - $eTag = $eTag . $comma . $type->convertToOData($value); |
|
| 227 | + $eTag = $eTag.$comma.$type->convertToOData($value); |
|
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | $comma = ','; |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | // IType::converToOData will perform utf8 and url encode. But we don't |
| 236 | 236 | // want this for eTag value. |
| 237 | 237 | $eTag = urldecode(utf8_decode($eTag)); |
| 238 | - return ODataConstants::HTTP_WEAK_ETAG_PREFIX . rtrim($eTag, ',') . '"'; |
|
| 238 | + return ODataConstants::HTTP_WEAK_ETAG_PREFIX.rtrim($eTag, ',').'"'; |
|
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | return null; |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | * @throws InvalidOperationException If this function invoked with non-navigation |
| 271 | 271 | * property instance. |
| 272 | 272 | */ |
| 273 | - protected function pushSegmentForNavigationProperty(ResourceProperty &$resourceProperty) |
|
| 273 | + protected function pushSegmentForNavigationProperty(ResourceProperty & $resourceProperty) |
|
| 274 | 274 | { |
| 275 | 275 | if ($resourceProperty->getTypeKind() == ResourceTypeKind::ENTITY) { |
| 276 | 276 | $this->assert(!empty($this->_segmentNames), '!is_empty($this->_segmentNames'); |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | * |
| 384 | 384 | * @return bool true if the segment was push, false otherwise |
| 385 | 385 | */ |
| 386 | - private function _pushSegment($segmentName, ResourceSetWrapper &$resourceSetWrapper) |
|
| 386 | + private function _pushSegment($segmentName, ResourceSetWrapper & $resourceSetWrapper) |
|
| 387 | 387 | { |
| 388 | 388 | $rootProjectionNode = $this->request->getRootProjectionNode(); |
| 389 | 389 | // Even though there is no expand in the request URI, still we need to push |
@@ -434,10 +434,10 @@ discard block |
||
| 434 | 434 | $queryParameterString = $this->getNextPageLinkQueryParametersForExpandedResourceSet(); |
| 435 | 435 | } |
| 436 | 436 | |
| 437 | - $queryParameterString .= '$skiptoken=' . $skipToken; |
|
| 437 | + $queryParameterString .= '$skiptoken='.$skipToken; |
|
| 438 | 438 | $odalaLink = new ODataLink(); |
| 439 | 439 | $odalaLink->name = ODataConstants::ATOM_LINK_NEXT_ATTRIBUTE_STRING; |
| 440 | - $odalaLink->url = rtrim($absoluteUri, '/') . '?' . $queryParameterString; |
|
| 440 | + $odalaLink->url = rtrim($absoluteUri, '/').'?'.$queryParameterString; |
|
| 441 | 441 | return $odalaLink; |
| 442 | 442 | } |
| 443 | 443 | |
@@ -462,21 +462,21 @@ discard block |
||
| 462 | 462 | $value = $this->service->getHost()->getQueryStringItem($queryOption); |
| 463 | 463 | if (!is_null($value)) { |
| 464 | 464 | if (!is_null($queryParameterString)) { |
| 465 | - $queryParameterString = $queryParameterString . '&'; |
|
| 465 | + $queryParameterString = $queryParameterString.'&'; |
|
| 466 | 466 | } |
| 467 | 467 | |
| 468 | - $queryParameterString .= $queryOption . '=' . $value; |
|
| 468 | + $queryParameterString .= $queryOption.'='.$value; |
|
| 469 | 469 | } |
| 470 | 470 | } |
| 471 | 471 | |
| 472 | 472 | $topCountValue = $this->request->getTopOptionCount(); |
| 473 | 473 | if (!is_null($topCountValue)) { |
| 474 | - $remainingCount = $topCountValue - $this->request->getTopCount(); |
|
| 474 | + $remainingCount = $topCountValue - $this->request->getTopCount(); |
|
| 475 | 475 | if (!is_null($queryParameterString)) { |
| 476 | 476 | $queryParameterString .= '&'; |
| 477 | 477 | } |
| 478 | 478 | |
| 479 | - $queryParameterString .= ODataConstants::HTTPQUERY_STRING_TOP . '=' . $remainingCount; |
|
| 479 | + $queryParameterString .= ODataConstants::HTTPQUERY_STRING_TOP.'='.$remainingCount; |
|
| 480 | 480 | } |
| 481 | 481 | |
| 482 | 482 | if (!is_null($queryParameterString)) { |
@@ -519,7 +519,7 @@ discard block |
||
| 519 | 519 | } |
| 520 | 520 | |
| 521 | 521 | if (!is_null($selectionPaths)) { |
| 522 | - $queryParameterString = '$select=' . $selectionPaths; |
|
| 522 | + $queryParameterString = '$select='.$selectionPaths; |
|
| 523 | 523 | } |
| 524 | 524 | |
| 525 | 525 | if (!is_null($expansionPaths)) { |
@@ -527,7 +527,7 @@ discard block |
||
| 527 | 527 | $queryParameterString .= '&'; |
| 528 | 528 | } |
| 529 | 529 | |
| 530 | - $queryParameterString = '$expand=' . $expansionPaths; |
|
| 530 | + $queryParameterString = '$expand='.$expansionPaths; |
|
| 531 | 531 | } |
| 532 | 532 | |
| 533 | 533 | if (!is_null($queryParameterString)) { |
@@ -637,7 +637,7 @@ discard block |
||
| 637 | 637 | */ |
| 638 | 638 | private function _buildSelectionAndExpansionPathsForNode(&$parentPathSegments, |
| 639 | 639 | &$selectionPaths, &$expansionPaths, |
| 640 | - ExpandedProjectionNode &$expandedProjectionNode, |
|
| 640 | + ExpandedProjectionNode & $expandedProjectionNode, |
|
| 641 | 641 | &$foundSelections, &$foundExpansions |
| 642 | 642 | ) { |
| 643 | 643 | $foundSelections = false; |
@@ -668,7 +668,7 @@ discard block |
||
| 668 | 668 | $this->_appendSelectionOrExpandPath( |
| 669 | 669 | $selectionPaths, |
| 670 | 670 | $parentPathSegments, |
| 671 | - $childNode->getPropertyName() . '/*' |
|
| 671 | + $childNode->getPropertyName().'/*' |
|
| 672 | 672 | ); |
| 673 | 673 | } else { |
| 674 | 674 | $expandedChildrenNeededToBeSelected[] = $childNode; |
@@ -714,7 +714,7 @@ discard block |
||
| 714 | 714 | } |
| 715 | 715 | |
| 716 | 716 | foreach ($parentPathSegments as $parentPathSegment) { |
| 717 | - $path .= $parentPathSegment . '/'; |
|
| 717 | + $path .= $parentPathSegment.'/'; |
|
| 718 | 718 | } |
| 719 | 719 | |
| 720 | 720 | $path .= $segmentToAppend; |
@@ -8,7 +8,6 @@ |
||
| 8 | 8 | use POData\Common\Url; |
| 9 | 9 | use POData\Common\UrlFormatException; |
| 10 | 10 | use POData\Common\ODataException; |
| 11 | -use POData\Common\InvalidOperationException; |
|
| 12 | 11 | use POData\OperationContext\Web\WebOperationContext; |
| 13 | 12 | use POData\OperationContext\IOperationContext; |
| 14 | 13 | use POData\Common\Version; |
@@ -80,16 +80,16 @@ discard block |
||
| 80 | 80 | return $this->_operationContext; |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - /** |
|
| 84 | - * @param IOperationContext $context the OperationContext implementation to use. If null the WebOperationContext |
|
| 85 | - * will be used. Defaults to null. |
|
| 86 | - */ |
|
| 87 | - public function __construct(IOperationContext $context = null) |
|
| 83 | + /** |
|
| 84 | + * @param IOperationContext $context the OperationContext implementation to use. If null the WebOperationContext |
|
| 85 | + * will be used. Defaults to null. |
|
| 86 | + */ |
|
| 87 | + public function __construct(IOperationContext $context = null) |
|
| 88 | 88 | { |
| 89 | 89 | if(is_null($context)){ |
| 90 | - $this->_operationContext = new WebOperationContext(); |
|
| 90 | + $this->_operationContext = new WebOperationContext(); |
|
| 91 | 91 | } else { |
| 92 | - $this->_operationContext = $context; |
|
| 92 | + $this->_operationContext = $context; |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | // getAbsoluteRequestUri can throw UrlFormatException |
@@ -99,13 +99,13 @@ discard block |
||
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
| 102 | - * Gets the absolute request Uri as Url instance |
|
| 103 | - * Note: This method will be called first time from constructor. |
|
| 104 | - * |
|
| 105 | - * @throws ODataException if AbsoluteRequestUri is not a valid URI |
|
| 106 | - * |
|
| 107 | - * @return Url |
|
| 108 | - */ |
|
| 102 | + * Gets the absolute request Uri as Url instance |
|
| 103 | + * Note: This method will be called first time from constructor. |
|
| 104 | + * |
|
| 105 | + * @throws ODataException if AbsoluteRequestUri is not a valid URI |
|
| 106 | + * |
|
| 107 | + * @return Url |
|
| 108 | + */ |
|
| 109 | 109 | public function getAbsoluteRequestUri() |
| 110 | 110 | { |
| 111 | 111 | if (is_null($this->_absoluteRequestUri)) { |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | try { |
| 115 | 115 | new Url($this->_absoluteRequestUriAsString); |
| 116 | 116 | } catch (UrlFormatException $exception) { |
| 117 | - throw ODataException::createBadRequestError($exception->getMessage()); |
|
| 117 | + throw ODataException::createBadRequestError($exception->getMessage()); |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | $queryStartIndex = strpos($this->_absoluteRequestUriAsString, '?'); |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | $j = count($segments) - 1; |
| 195 | 195 | $k = $i; |
| 196 | 196 | if ($j > $i) { |
| 197 | - throw ODataException::createBadRequestError( |
|
| 197 | + throw ODataException::createBadRequestError( |
|
| 198 | 198 | Messages::hostRequestUriIsNotBasedOnRelativeUriInConfig( |
| 199 | 199 | $this->_absoluteRequestUriAsString, |
| 200 | 200 | $serviceUri |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | if ($j != -1) { |
| 210 | - throw ODataException::createBadRequestError( |
|
| 210 | + throw ODataException::createBadRequestError( |
|
| 211 | 211 | Messages::hostRequestUriIsNotBasedOnRelativeUriInConfig( |
| 212 | 212 | $this->_absoluteRequestUriAsString, |
| 213 | 213 | $serviceUri |
@@ -280,13 +280,13 @@ discard block |
||
| 280 | 280 | if (!empty($optionValue)) { |
| 281 | 281 | if ($optionValue[0] == '$') { |
| 282 | 282 | if ($this->_isODataQueryOption($optionValue)) { |
| 283 | - throw ODataException::createBadRequestError( |
|
| 283 | + throw ODataException::createBadRequestError( |
|
| 284 | 284 | Messages::hostODataQueryOptionFoundWithoutValue( |
| 285 | 285 | $optionValue |
| 286 | 286 | ) |
| 287 | 287 | ); |
| 288 | 288 | } else { |
| 289 | - throw ODataException::createBadRequestError( |
|
| 289 | + throw ODataException::createBadRequestError( |
|
| 290 | 290 | Messages::hostNonODataOptionBeginsWithSystemCharacter( |
| 291 | 291 | $optionValue |
| 292 | 292 | ) |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | } else { |
| 298 | 298 | if ($optionName[0] == '$') { |
| 299 | 299 | if (!$this->_isODataQueryOption($optionName)) { |
| 300 | - throw ODataException::createBadRequestError( |
|
| 300 | + throw ODataException::createBadRequestError( |
|
| 301 | 301 | Messages::hostNonODataOptionBeginsWithSystemCharacter( |
| 302 | 302 | $optionName |
| 303 | 303 | ) |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | if (array_search($optionName, $namesFound) !== false) { |
| 308 | - throw ODataException::createBadRequestError( |
|
| 308 | + throw ODataException::createBadRequestError( |
|
| 309 | 309 | Messages::hostODataQueryOptionCannotBeSpecifiedMoreThanOnce( |
| 310 | 310 | $optionName |
| 311 | 311 | ) |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | if (empty($optionValue) && $optionValue !== '0') { |
| 316 | - throw ODataException::createBadRequestError( |
|
| 316 | + throw ODataException::createBadRequestError( |
|
| 317 | 317 | Messages::hostODataQueryOptionFoundWithoutValue( |
| 318 | 318 | $optionName |
| 319 | 319 | ) |
@@ -629,29 +629,29 @@ discard block |
||
| 629 | 629 | ->outgoingResponse()->addHeader($headerName, $headerValue); |
| 630 | 630 | } |
| 631 | 631 | |
| 632 | - /** |
|
| 633 | - * Translates the short $format forms into the full mime type forms |
|
| 634 | - * @param Version $responseVersion the version scheme to interpret the short form with |
|
| 635 | - * @param string $format the short $format form |
|
| 636 | - * @return string the full mime type corresponding to the short format form for the given version |
|
| 637 | - */ |
|
| 638 | - public static function translateFormatToMime(Version $responseVersion, $format){ |
|
| 632 | + /** |
|
| 633 | + * Translates the short $format forms into the full mime type forms |
|
| 634 | + * @param Version $responseVersion the version scheme to interpret the short form with |
|
| 635 | + * @param string $format the short $format form |
|
| 636 | + * @return string the full mime type corresponding to the short format form for the given version |
|
| 637 | + */ |
|
| 638 | + public static function translateFormatToMime(Version $responseVersion, $format){ |
|
| 639 | 639 | //TODO: should the version switches be off of the requestVersion, not the response version? see #91 |
| 640 | 640 | |
| 641 | 641 | switch($format) { |
| 642 | 642 | |
| 643 | - case ODataConstants::FORMAT_XML: |
|
| 644 | - $format = MimeTypes::MIME_APPLICATION_XML; |
|
| 645 | - break; |
|
| 643 | + case ODataConstants::FORMAT_XML: |
|
| 644 | + $format = MimeTypes::MIME_APPLICATION_XML; |
|
| 645 | + break; |
|
| 646 | 646 | |
| 647 | 647 | case ODataConstants::FORMAT_ATOM: |
| 648 | - $format = MimeTypes::MIME_APPLICATION_ATOM ; |
|
| 649 | - break; |
|
| 648 | + $format = MimeTypes::MIME_APPLICATION_ATOM ; |
|
| 649 | + break; |
|
| 650 | 650 | |
| 651 | 651 | case ODataConstants::FORMAT_VERBOSE_JSON: |
| 652 | 652 | if($responseVersion == Version::v3()){ |
| 653 | - //only translatable in 3.0 systems |
|
| 654 | - $format = MimeTypes::MIME_APPLICATION_JSON_VERBOSE; |
|
| 653 | + //only translatable in 3.0 systems |
|
| 654 | + $format = MimeTypes::MIME_APPLICATION_JSON_VERBOSE; |
|
| 655 | 655 | } |
| 656 | 656 | break; |
| 657 | 657 | |
@@ -659,13 +659,13 @@ discard block |
||
| 659 | 659 | if($responseVersion == Version::v3()){ |
| 660 | 660 | $format = MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META; |
| 661 | 661 | } else{ |
| 662 | - $format = MimeTypes::MIME_APPLICATION_JSON; |
|
| 662 | + $format = MimeTypes::MIME_APPLICATION_JSON; |
|
| 663 | 663 | } |
| 664 | - break; |
|
| 664 | + break; |
|
| 665 | 665 | |
| 666 | 666 | } |
| 667 | 667 | |
| 668 | - return $format . ';q=1.0'; |
|
| 668 | + return $format . ';q=1.0'; |
|
| 669 | 669 | } |
| 670 | 670 | |
| 671 | 671 | |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | public function __construct(IOperationContext $context = null) |
| 88 | 88 | { |
| 89 | - if(is_null($context)){ |
|
| 89 | + if (is_null($context)) { |
|
| 90 | 90 | $this->_operationContext = new WebOperationContext(); |
| 91 | 91 | } else { |
| 92 | 92 | $this->_operationContext = $context; |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | $isAbsoluteServiceUri = (strpos($serviceUri, 'http://') === 0) |
| 163 | 163 | || (strpos($serviceUri, 'https://') === 0); |
| 164 | 164 | try { |
| 165 | - $this->_absoluteServiceUri = new Url($serviceUri, $isAbsoluteServiceUri ); |
|
| 165 | + $this->_absoluteServiceUri = new Url($serviceUri, $isAbsoluteServiceUri); |
|
| 166 | 166 | } catch (UrlFormatException $exception) { |
| 167 | 167 | throw ODataException::createInternalServerError(Messages::hostMalFormedBaseUriInConfig()); |
| 168 | 168 | } |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | // Find index of segment in the request uri that end with .svc |
| 185 | 185 | // There will be always a .svc segment in the request uri otherwise |
| 186 | 186 | // uri redirection will not happen. |
| 187 | - for (; $i >=0; $i--) { |
|
| 187 | + for (; $i >= 0; $i--) { |
|
| 188 | 188 | $endsWithSvc = (substr_compare($requestUriSegments[$i], '.svc', -strlen('.svc'), strlen('.svc')) === 0); |
| 189 | 189 | if ($endsWithSvc) { |
| 190 | 190 | break; |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | . $this->_absoluteRequestUri->getPort(); |
| 223 | 223 | |
| 224 | 224 | for ($l = 0; $l <= $k; $l++) { |
| 225 | - $serviceUri .= '/' . $requestUriSegments[$l]; |
|
| 225 | + $serviceUri .= '/'.$requestUriSegments[$l]; |
|
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | $this->_absoluteServiceUri = new Url($serviceUri); |
@@ -552,18 +552,18 @@ discard block |
||
| 552 | 552 | */ |
| 553 | 553 | public function setResponseStatusCode($value) |
| 554 | 554 | { |
| 555 | - $floor = floor($value / 100); |
|
| 555 | + $floor = floor($value/100); |
|
| 556 | 556 | if ($floor >= 1 && $floor <= 5) { |
| 557 | 557 | $statusDescription = HttpStatus::getStatusDescription($value); |
| 558 | 558 | if (!is_null($statusDescription)) { |
| 559 | - $statusDescription = ' ' . $statusDescription; |
|
| 559 | + $statusDescription = ' '.$statusDescription; |
|
| 560 | 560 | } |
| 561 | 561 | |
| 562 | 562 | $this->_operationContext |
| 563 | - ->outgoingResponse()->setStatusCode($value . $statusDescription); |
|
| 563 | + ->outgoingResponse()->setStatusCode($value.$statusDescription); |
|
| 564 | 564 | } else { |
| 565 | 565 | throw ODataException::createInternalServerError( |
| 566 | - 'Invalid Status Code' . $value |
|
| 566 | + 'Invalid Status Code'.$value |
|
| 567 | 567 | ); |
| 568 | 568 | } |
| 569 | 569 | } |
@@ -635,37 +635,37 @@ discard block |
||
| 635 | 635 | * @param string $format the short $format form |
| 636 | 636 | * @return string the full mime type corresponding to the short format form for the given version |
| 637 | 637 | */ |
| 638 | - public static function translateFormatToMime(Version $responseVersion, $format){ |
|
| 638 | + public static function translateFormatToMime(Version $responseVersion, $format) { |
|
| 639 | 639 | //TODO: should the version switches be off of the requestVersion, not the response version? see #91 |
| 640 | 640 | |
| 641 | - switch($format) { |
|
| 641 | + switch ($format) { |
|
| 642 | 642 | |
| 643 | 643 | case ODataConstants::FORMAT_XML: |
| 644 | 644 | $format = MimeTypes::MIME_APPLICATION_XML; |
| 645 | 645 | break; |
| 646 | 646 | |
| 647 | 647 | case ODataConstants::FORMAT_ATOM: |
| 648 | - $format = MimeTypes::MIME_APPLICATION_ATOM ; |
|
| 648 | + $format = MimeTypes::MIME_APPLICATION_ATOM; |
|
| 649 | 649 | break; |
| 650 | 650 | |
| 651 | 651 | case ODataConstants::FORMAT_VERBOSE_JSON: |
| 652 | - if($responseVersion == Version::v3()){ |
|
| 652 | + if ($responseVersion == Version::v3()) { |
|
| 653 | 653 | //only translatable in 3.0 systems |
| 654 | 654 | $format = MimeTypes::MIME_APPLICATION_JSON_VERBOSE; |
| 655 | 655 | } |
| 656 | 656 | break; |
| 657 | 657 | |
| 658 | 658 | case ODataConstants::FORMAT_JSON: |
| 659 | - if($responseVersion == Version::v3()){ |
|
| 659 | + if ($responseVersion == Version::v3()) { |
|
| 660 | 660 | $format = MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META; |
| 661 | - } else{ |
|
| 661 | + } else { |
|
| 662 | 662 | $format = MimeTypes::MIME_APPLICATION_JSON; |
| 663 | 663 | } |
| 664 | 664 | break; |
| 665 | 665 | |
| 666 | 666 | } |
| 667 | 667 | |
| 668 | - return $format . ';q=1.0'; |
|
| 668 | + return $format.';q=1.0'; |
|
| 669 | 669 | } |
| 670 | 670 | |
| 671 | 671 | |
@@ -2,9 +2,7 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace POData\OperationContext\Web; |
| 4 | 4 | |
| 5 | -use POData\Common\ODataException; |
|
| 6 | 5 | use POData\Common\ODataConstants; |
| 7 | -use POData\Common\Url; |
|
| 8 | 6 | use POData\HttpProcessUtility; |
| 9 | 7 | use POData\OperationContext\HTTPRequestMethod; |
| 10 | 8 | use POData\OperationContext\IHTTPRequest; |
@@ -152,10 +152,10 @@ |
||
| 152 | 152 | */ |
| 153 | 153 | public function getRequestHeader($key) |
| 154 | 154 | { |
| 155 | - //PHP normalizes header keys |
|
| 156 | - $trimmedKey = HttpProcessUtility::headerToServerKey(trim($key)); |
|
| 155 | + //PHP normalizes header keys |
|
| 156 | + $trimmedKey = HttpProcessUtility::headerToServerKey(trim($key)); |
|
| 157 | 157 | |
| 158 | - if (array_key_exists($trimmedKey, $this->_headers)) { |
|
| 158 | + if (array_key_exists($trimmedKey, $this->_headers)) { |
|
| 159 | 159 | return $this->_headers[$trimmedKey]; |
| 160 | 160 | } |
| 161 | 161 | |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | * |
| 30 | 30 | * @var string |
| 31 | 31 | */ |
| 32 | - private $_rawUrl = null; |
|
| 32 | + private $_rawUrl = null; |
|
| 33 | 33 | |
| 34 | 34 | |
| 35 | 35 | /** |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | $isNamedOptions = count($result) == 2; |
| 196 | 196 | if ($isNamedOptions) { |
| 197 | 197 | $this->_queryOptions[] |
| 198 | - = array (rawurldecode($result[0]) => trim(rawurldecode($result[1]))); |
|
| 198 | + = array(rawurldecode($result[0]) => trim(rawurldecode($result[1]))); |
|
| 199 | 199 | } else { |
| 200 | 200 | $this->_queryOptions[] |
| 201 | 201 | = array(null => trim(rawurldecode($result[0]))); |
@@ -3,7 +3,6 @@ |
||
| 3 | 3 | namespace POData\OperationContext\Web; |
| 4 | 4 | |
| 5 | 5 | use POData\Common\ODataConstants; |
| 6 | -use POData\Common\ODataException; |
|
| 7 | 6 | |
| 8 | 7 | |
| 9 | 8 | /** |
@@ -6,7 +6,6 @@ |
||
| 6 | 6 | use POData\Providers\Metadata\ResourceType; |
| 7 | 7 | use POData\UriProcessor\QueryProcessor\ExpressionParser\Expressions\ExpressionType; |
| 8 | 8 | use POData\Providers\Metadata\Type\IType; |
| 9 | -use POData\Common\NotImplementedException; |
|
| 10 | 9 | use POData\Common\ODataConstants; |
| 11 | 10 | use POData\UriProcessor\QueryProcessor\FunctionDescription; |
| 12 | 11 | use POData\UriProcessor\QueryProcessor\ExpressionParser\Expressions\PropertyAccessExpression; |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | */ |
| 81 | 81 | public function setResourceType(ResourceType $resourceType) |
| 82 | 82 | { |
| 83 | - $this->_resourceType = $resourceType; |
|
| 83 | + $this->_resourceType = $resourceType; |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | /** |
@@ -95,14 +95,14 @@ discard block |
||
| 95 | 95 | public function onLogicalExpression($expressionType, $left, $right) |
| 96 | 96 | { |
| 97 | 97 | switch($expressionType) { |
| 98 | - case ExpressionType::AND_LOGICAL: |
|
| 99 | - return $this->_prepareBinaryExpression(self::LOGICAL_AND, $left, $right); |
|
| 98 | + case ExpressionType::AND_LOGICAL: |
|
| 99 | + return $this->_prepareBinaryExpression(self::LOGICAL_AND, $left, $right); |
|
| 100 | 100 | |
| 101 | - case ExpressionType::OR_LOGICAL: |
|
| 102 | - return $this->_prepareBinaryExpression(self::LOGICAL_OR, $left, $right); |
|
| 101 | + case ExpressionType::OR_LOGICAL: |
|
| 102 | + return $this->_prepareBinaryExpression(self::LOGICAL_OR, $left, $right); |
|
| 103 | 103 | |
| 104 | - default: |
|
| 105 | - throw new \InvalidArgumentException('onLogicalExpression'); |
|
| 104 | + default: |
|
| 105 | + throw new \InvalidArgumentException('onLogicalExpression'); |
|
| 106 | 106 | } |
| 107 | 107 | } |
| 108 | 108 | |
@@ -118,23 +118,23 @@ discard block |
||
| 118 | 118 | public function onArithmeticExpression($expressionType, $left, $right) |
| 119 | 119 | { |
| 120 | 120 | switch($expressionType) { |
| 121 | - case ExpressionType::MULTIPLY: |
|
| 122 | - return $this->_prepareBinaryExpression(self::MULTIPLY, $left, $right); |
|
| 121 | + case ExpressionType::MULTIPLY: |
|
| 122 | + return $this->_prepareBinaryExpression(self::MULTIPLY, $left, $right); |
|
| 123 | 123 | |
| 124 | - case ExpressionType::DIVIDE: |
|
| 125 | - return $this->_prepareBinaryExpression(self::DIVIDE, $left, $right); |
|
| 124 | + case ExpressionType::DIVIDE: |
|
| 125 | + return $this->_prepareBinaryExpression(self::DIVIDE, $left, $right); |
|
| 126 | 126 | |
| 127 | - case ExpressionType::MODULO: |
|
| 128 | - return $this->_prepareBinaryExpression(self::MODULO, $left, $right); |
|
| 127 | + case ExpressionType::MODULO: |
|
| 128 | + return $this->_prepareBinaryExpression(self::MODULO, $left, $right); |
|
| 129 | 129 | |
| 130 | - case ExpressionType::ADD: |
|
| 131 | - return $this->_prepareBinaryExpression(self::ADD, $left, $right); |
|
| 130 | + case ExpressionType::ADD: |
|
| 131 | + return $this->_prepareBinaryExpression(self::ADD, $left, $right); |
|
| 132 | 132 | |
| 133 | - case ExpressionType::SUBTRACT: |
|
| 134 | - return $this->_prepareBinaryExpression(self::SUBTRACT, $left, $right); |
|
| 133 | + case ExpressionType::SUBTRACT: |
|
| 134 | + return $this->_prepareBinaryExpression(self::SUBTRACT, $left, $right); |
|
| 135 | 135 | |
| 136 | - default: |
|
| 137 | - throw new \InvalidArgumentException('onArithmeticExpression'); |
|
| 136 | + default: |
|
| 137 | + throw new \InvalidArgumentException('onArithmeticExpression'); |
|
| 138 | 138 | } |
| 139 | 139 | } |
| 140 | 140 | |
@@ -150,26 +150,26 @@ discard block |
||
| 150 | 150 | public function onRelationalExpression($expressionType, $left, $right) |
| 151 | 151 | { |
| 152 | 152 | switch($expressionType) { |
| 153 | - case ExpressionType::GREATERTHAN: |
|
| 154 | - return $this->_prepareBinaryExpression(self::GREATER_THAN, $left, $right); |
|
| 153 | + case ExpressionType::GREATERTHAN: |
|
| 154 | + return $this->_prepareBinaryExpression(self::GREATER_THAN, $left, $right); |
|
| 155 | 155 | |
| 156 | - case ExpressionType::GREATERTHAN_OR_EQUAL: |
|
| 157 | - return $this->_prepareBinaryExpression(self::GREATER_THAN_OR_EQUAL, $left, $right); |
|
| 156 | + case ExpressionType::GREATERTHAN_OR_EQUAL: |
|
| 157 | + return $this->_prepareBinaryExpression(self::GREATER_THAN_OR_EQUAL, $left, $right); |
|
| 158 | 158 | |
| 159 | - case ExpressionType::LESSTHAN: |
|
| 160 | - return $this->_prepareBinaryExpression(self::LESS_THAN, $left, $right); |
|
| 159 | + case ExpressionType::LESSTHAN: |
|
| 160 | + return $this->_prepareBinaryExpression(self::LESS_THAN, $left, $right); |
|
| 161 | 161 | |
| 162 | - case ExpressionType::LESSTHAN_OR_EQUAL: |
|
| 163 | - return $this->_prepareBinaryExpression(self::LESS_THAN_OR_EQUAL, $left, $right); |
|
| 162 | + case ExpressionType::LESSTHAN_OR_EQUAL: |
|
| 163 | + return $this->_prepareBinaryExpression(self::LESS_THAN_OR_EQUAL, $left, $right); |
|
| 164 | 164 | |
| 165 | - case ExpressionType::EQUAL: |
|
| 166 | - return $this->_prepareBinaryExpression(self::EQUAL, $left, $right); |
|
| 165 | + case ExpressionType::EQUAL: |
|
| 166 | + return $this->_prepareBinaryExpression(self::EQUAL, $left, $right); |
|
| 167 | 167 | |
| 168 | - case ExpressionType::NOTEQUAL: |
|
| 169 | - return $this->_prepareBinaryExpression(self::NOT_EQUAL, $left, $right); |
|
| 168 | + case ExpressionType::NOTEQUAL: |
|
| 169 | + return $this->_prepareBinaryExpression(self::NOT_EQUAL, $left, $right); |
|
| 170 | 170 | |
| 171 | - default: |
|
| 172 | - throw new \InvalidArgumentException('onArithmeticExpression'); |
|
| 171 | + default: |
|
| 172 | + throw new \InvalidArgumentException('onArithmeticExpression'); |
|
| 173 | 173 | } |
| 174 | 174 | } |
| 175 | 175 | |
@@ -184,14 +184,14 @@ discard block |
||
| 184 | 184 | public function onUnaryExpression($expressionType, $child) |
| 185 | 185 | { |
| 186 | 186 | switch($expressionType) { |
| 187 | - case ExpressionType::NEGATE: |
|
| 188 | - return $this->_prepareUnaryExpression(self::NEGATE, $child); |
|
| 187 | + case ExpressionType::NEGATE: |
|
| 188 | + return $this->_prepareUnaryExpression(self::NEGATE, $child); |
|
| 189 | 189 | |
| 190 | - case ExpressionType::NOT_LOGICAL: |
|
| 191 | - return $this->_prepareUnaryExpression(self::LOGICAL_NOT, $child); |
|
| 190 | + case ExpressionType::NOT_LOGICAL: |
|
| 191 | + return $this->_prepareUnaryExpression(self::LOGICAL_NOT, $child); |
|
| 192 | 192 | |
| 193 | - default: |
|
| 194 | - throw new \InvalidArgumentException('onUnaryExpression'); |
|
| 193 | + default: |
|
| 194 | + throw new \InvalidArgumentException('onUnaryExpression'); |
|
| 195 | 195 | } |
| 196 | 196 | } |
| 197 | 197 | |
@@ -247,85 +247,85 @@ discard block |
||
| 247 | 247 | public function onFunctionCallExpression($functionDescription, $params) |
| 248 | 248 | { |
| 249 | 249 | switch($functionDescription->name) { |
| 250 | - case ODataConstants::STRFUN_COMPARE: |
|
| 251 | - return "strcmp($params[0], $params[1])"; |
|
| 250 | + case ODataConstants::STRFUN_COMPARE: |
|
| 251 | + return "strcmp($params[0], $params[1])"; |
|
| 252 | 252 | |
| 253 | - case ODataConstants::STRFUN_ENDSWITH: |
|
| 254 | - return "(strcmp(substr($params[0], strlen($params[0]) - strlen($params[1])), $params[1]) === 0)"; |
|
| 253 | + case ODataConstants::STRFUN_ENDSWITH: |
|
| 254 | + return "(strcmp(substr($params[0], strlen($params[0]) - strlen($params[1])), $params[1]) === 0)"; |
|
| 255 | 255 | |
| 256 | - case ODataConstants::STRFUN_INDEXOF: |
|
| 257 | - return "strpos($params[0], $params[1])"; |
|
| 256 | + case ODataConstants::STRFUN_INDEXOF: |
|
| 257 | + return "strpos($params[0], $params[1])"; |
|
| 258 | 258 | |
| 259 | - case ODataConstants::STRFUN_REPLACE: |
|
| 260 | - return "str_replace($params[1], $params[2], $params[0])"; |
|
| 259 | + case ODataConstants::STRFUN_REPLACE: |
|
| 260 | + return "str_replace($params[1], $params[2], $params[0])"; |
|
| 261 | 261 | |
| 262 | - case ODataConstants::STRFUN_STARTSWITH: |
|
| 263 | - return "(strpos($params[0], $params[1]) === 0)"; |
|
| 262 | + case ODataConstants::STRFUN_STARTSWITH: |
|
| 263 | + return "(strpos($params[0], $params[1]) === 0)"; |
|
| 264 | 264 | |
| 265 | - case ODataConstants::STRFUN_TOLOWER: |
|
| 266 | - return "strtolower($params[0])"; |
|
| 265 | + case ODataConstants::STRFUN_TOLOWER: |
|
| 266 | + return "strtolower($params[0])"; |
|
| 267 | 267 | |
| 268 | - case ODataConstants::STRFUN_TOUPPER: |
|
| 269 | - return "strtoupper($params[0])"; |
|
| 268 | + case ODataConstants::STRFUN_TOUPPER: |
|
| 269 | + return "strtoupper($params[0])"; |
|
| 270 | 270 | |
| 271 | - case ODataConstants::STRFUN_TRIM: |
|
| 272 | - return "trim($params[0])"; |
|
| 271 | + case ODataConstants::STRFUN_TRIM: |
|
| 272 | + return "trim($params[0])"; |
|
| 273 | 273 | |
| 274 | - case ODataConstants::STRFUN_SUBSTRING: |
|
| 275 | - return count($params) == 3 ? |
|
| 276 | - "substr($params[0], $params[1], $params[2])" : |
|
| 277 | - "substr($params[0], $params[1])"; |
|
| 274 | + case ODataConstants::STRFUN_SUBSTRING: |
|
| 275 | + return count($params) == 3 ? |
|
| 276 | + "substr($params[0], $params[1], $params[2])" : |
|
| 277 | + "substr($params[0], $params[1])"; |
|
| 278 | 278 | |
| 279 | - case ODataConstants::STRFUN_SUBSTRINGOF: |
|
| 280 | - return "(strpos($params[1], $params[0]) !== false)"; |
|
| 279 | + case ODataConstants::STRFUN_SUBSTRINGOF: |
|
| 280 | + return "(strpos($params[1], $params[0]) !== false)"; |
|
| 281 | 281 | |
| 282 | - case ODataConstants::STRFUN_CONCAT: |
|
| 283 | - return $params[0] . ' . ' . $params[1]; |
|
| 282 | + case ODataConstants::STRFUN_CONCAT: |
|
| 283 | + return $params[0] . ' . ' . $params[1]; |
|
| 284 | 284 | |
| 285 | - case ODataConstants::STRFUN_LENGTH: |
|
| 286 | - return "strlen($params[0])"; |
|
| 285 | + case ODataConstants::STRFUN_LENGTH: |
|
| 286 | + return "strlen($params[0])"; |
|
| 287 | 287 | |
| 288 | - case ODataConstants::GUIDFUN_EQUAL: |
|
| 289 | - return self::TYPE_NAMESPACE . "Guid::guidEqual($params[0], $params[1])"; |
|
| 288 | + case ODataConstants::GUIDFUN_EQUAL: |
|
| 289 | + return self::TYPE_NAMESPACE . "Guid::guidEqual($params[0], $params[1])"; |
|
| 290 | 290 | |
| 291 | - case ODataConstants::DATETIME_COMPARE: |
|
| 292 | - return self::TYPE_NAMESPACE . "DateTime::dateTimeCmp($params[0], $params[1])"; |
|
| 291 | + case ODataConstants::DATETIME_COMPARE: |
|
| 292 | + return self::TYPE_NAMESPACE . "DateTime::dateTimeCmp($params[0], $params[1])"; |
|
| 293 | 293 | |
| 294 | - case ODataConstants::DATETIME_YEAR: |
|
| 295 | - return self::TYPE_NAMESPACE . "DateTime::year($params[0])"; |
|
| 294 | + case ODataConstants::DATETIME_YEAR: |
|
| 295 | + return self::TYPE_NAMESPACE . "DateTime::year($params[0])"; |
|
| 296 | 296 | |
| 297 | - case ODataConstants::DATETIME_MONTH: |
|
| 298 | - return self::TYPE_NAMESPACE . "DateTime::month($params[0])"; |
|
| 297 | + case ODataConstants::DATETIME_MONTH: |
|
| 298 | + return self::TYPE_NAMESPACE . "DateTime::month($params[0])"; |
|
| 299 | 299 | |
| 300 | - case ODataConstants::DATETIME_DAY: |
|
| 301 | - return self::TYPE_NAMESPACE . "DateTime::day($params[0])"; |
|
| 300 | + case ODataConstants::DATETIME_DAY: |
|
| 301 | + return self::TYPE_NAMESPACE . "DateTime::day($params[0])"; |
|
| 302 | 302 | |
| 303 | - case ODataConstants::DATETIME_HOUR: |
|
| 304 | - return self::TYPE_NAMESPACE . "DateTime::hour($params[0])"; |
|
| 303 | + case ODataConstants::DATETIME_HOUR: |
|
| 304 | + return self::TYPE_NAMESPACE . "DateTime::hour($params[0])"; |
|
| 305 | 305 | |
| 306 | - case ODataConstants::DATETIME_MINUTE: |
|
| 307 | - return self::TYPE_NAMESPACE . "DateTime::minute($params[0])"; |
|
| 306 | + case ODataConstants::DATETIME_MINUTE: |
|
| 307 | + return self::TYPE_NAMESPACE . "DateTime::minute($params[0])"; |
|
| 308 | 308 | |
| 309 | - case ODataConstants::DATETIME_SECOND: |
|
| 310 | - return self::TYPE_NAMESPACE . "DateTime::second($params[0])"; |
|
| 309 | + case ODataConstants::DATETIME_SECOND: |
|
| 310 | + return self::TYPE_NAMESPACE . "DateTime::second($params[0])"; |
|
| 311 | 311 | |
| 312 | - case ODataConstants::MATHFUN_ROUND: |
|
| 313 | - return "round($params[0])"; |
|
| 312 | + case ODataConstants::MATHFUN_ROUND: |
|
| 313 | + return "round($params[0])"; |
|
| 314 | 314 | |
| 315 | - case ODataConstants::MATHFUN_CEILING: |
|
| 316 | - return "ceil($params[0])"; |
|
| 315 | + case ODataConstants::MATHFUN_CEILING: |
|
| 316 | + return "ceil($params[0])"; |
|
| 317 | 317 | |
| 318 | - case ODataConstants::MATHFUN_FLOOR: |
|
| 319 | - return "floor($params[0])"; |
|
| 318 | + case ODataConstants::MATHFUN_FLOOR: |
|
| 319 | + return "floor($params[0])"; |
|
| 320 | 320 | |
| 321 | - case ODataConstants::BINFUL_EQUAL: |
|
| 322 | - return self::TYPE_NAMESPACE . "Binary::binaryEqual($params[0], $params[1])"; |
|
| 321 | + case ODataConstants::BINFUL_EQUAL: |
|
| 322 | + return self::TYPE_NAMESPACE . "Binary::binaryEqual($params[0], $params[1])"; |
|
| 323 | 323 | |
| 324 | - case 'is_null': |
|
| 325 | - return "is_null($params[0])"; |
|
| 324 | + case 'is_null': |
|
| 325 | + return "is_null($params[0])"; |
|
| 326 | 326 | |
| 327 | - default: |
|
| 328 | - throw new \InvalidArgumentException('onFunctionCallExpression'); |
|
| 327 | + default: |
|
| 328 | + throw new \InvalidArgumentException('onFunctionCallExpression'); |
|
| 329 | 329 | } |
| 330 | 330 | } |
| 331 | 331 | |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | */ |
| 95 | 95 | public function onLogicalExpression($expressionType, $left, $right) |
| 96 | 96 | { |
| 97 | - switch($expressionType) { |
|
| 97 | + switch ($expressionType) { |
|
| 98 | 98 | case ExpressionType::AND_LOGICAL: |
| 99 | 99 | return $this->_prepareBinaryExpression(self::LOGICAL_AND, $left, $right); |
| 100 | 100 | |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | public function onArithmeticExpression($expressionType, $left, $right) |
| 119 | 119 | { |
| 120 | - switch($expressionType) { |
|
| 120 | + switch ($expressionType) { |
|
| 121 | 121 | case ExpressionType::MULTIPLY: |
| 122 | 122 | return $this->_prepareBinaryExpression(self::MULTIPLY, $left, $right); |
| 123 | 123 | |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | */ |
| 150 | 150 | public function onRelationalExpression($expressionType, $left, $right) |
| 151 | 151 | { |
| 152 | - switch($expressionType) { |
|
| 152 | + switch ($expressionType) { |
|
| 153 | 153 | case ExpressionType::GREATERTHAN: |
| 154 | 154 | return $this->_prepareBinaryExpression(self::GREATER_THAN, $left, $right); |
| 155 | 155 | |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | */ |
| 184 | 184 | public function onUnaryExpression($expressionType, $child) |
| 185 | 185 | { |
| 186 | - switch($expressionType) { |
|
| 186 | + switch ($expressionType) { |
|
| 187 | 187 | case ExpressionType::NEGATE: |
| 188 | 188 | return $this->_prepareUnaryExpression(self::NEGATE, $child); |
| 189 | 189 | |
@@ -227,12 +227,12 @@ discard block |
||
| 227 | 227 | $variable = null; |
| 228 | 228 | |
| 229 | 229 | do { |
| 230 | - $variable = $parent->getResourceProperty()->getName() . self::MEMBER_ACCESS . $variable; |
|
| 230 | + $variable = $parent->getResourceProperty()->getName().self::MEMBER_ACCESS.$variable; |
|
| 231 | 231 | $parent = $parent->getParent(); |
| 232 | 232 | } while ($parent != null); |
| 233 | 233 | |
| 234 | 234 | $variable = rtrim($variable, self::MEMBER_ACCESS); |
| 235 | - $variable = $this->getIteratorName() . self::MEMBER_ACCESS . $variable; |
|
| 235 | + $variable = $this->getIteratorName().self::MEMBER_ACCESS.$variable; |
|
| 236 | 236 | return $variable; |
| 237 | 237 | } |
| 238 | 238 | |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | */ |
| 247 | 247 | public function onFunctionCallExpression($functionDescription, $params) |
| 248 | 248 | { |
| 249 | - switch($functionDescription->name) { |
|
| 249 | + switch ($functionDescription->name) { |
|
| 250 | 250 | case ODataConstants::STRFUN_COMPARE: |
| 251 | 251 | return "strcmp($params[0], $params[1])"; |
| 252 | 252 | |
@@ -273,41 +273,40 @@ discard block |
||
| 273 | 273 | |
| 274 | 274 | case ODataConstants::STRFUN_SUBSTRING: |
| 275 | 275 | return count($params) == 3 ? |
| 276 | - "substr($params[0], $params[1], $params[2])" : |
|
| 277 | - "substr($params[0], $params[1])"; |
|
| 276 | + "substr($params[0], $params[1], $params[2])" : "substr($params[0], $params[1])"; |
|
| 278 | 277 | |
| 279 | 278 | case ODataConstants::STRFUN_SUBSTRINGOF: |
| 280 | 279 | return "(strpos($params[1], $params[0]) !== false)"; |
| 281 | 280 | |
| 282 | 281 | case ODataConstants::STRFUN_CONCAT: |
| 283 | - return $params[0] . ' . ' . $params[1]; |
|
| 282 | + return $params[0].' . '.$params[1]; |
|
| 284 | 283 | |
| 285 | 284 | case ODataConstants::STRFUN_LENGTH: |
| 286 | 285 | return "strlen($params[0])"; |
| 287 | 286 | |
| 288 | 287 | case ODataConstants::GUIDFUN_EQUAL: |
| 289 | - return self::TYPE_NAMESPACE . "Guid::guidEqual($params[0], $params[1])"; |
|
| 288 | + return self::TYPE_NAMESPACE."Guid::guidEqual($params[0], $params[1])"; |
|
| 290 | 289 | |
| 291 | 290 | case ODataConstants::DATETIME_COMPARE: |
| 292 | - return self::TYPE_NAMESPACE . "DateTime::dateTimeCmp($params[0], $params[1])"; |
|
| 291 | + return self::TYPE_NAMESPACE."DateTime::dateTimeCmp($params[0], $params[1])"; |
|
| 293 | 292 | |
| 294 | 293 | case ODataConstants::DATETIME_YEAR: |
| 295 | - return self::TYPE_NAMESPACE . "DateTime::year($params[0])"; |
|
| 294 | + return self::TYPE_NAMESPACE."DateTime::year($params[0])"; |
|
| 296 | 295 | |
| 297 | 296 | case ODataConstants::DATETIME_MONTH: |
| 298 | - return self::TYPE_NAMESPACE . "DateTime::month($params[0])"; |
|
| 297 | + return self::TYPE_NAMESPACE."DateTime::month($params[0])"; |
|
| 299 | 298 | |
| 300 | 299 | case ODataConstants::DATETIME_DAY: |
| 301 | - return self::TYPE_NAMESPACE . "DateTime::day($params[0])"; |
|
| 300 | + return self::TYPE_NAMESPACE."DateTime::day($params[0])"; |
|
| 302 | 301 | |
| 303 | 302 | case ODataConstants::DATETIME_HOUR: |
| 304 | - return self::TYPE_NAMESPACE . "DateTime::hour($params[0])"; |
|
| 303 | + return self::TYPE_NAMESPACE."DateTime::hour($params[0])"; |
|
| 305 | 304 | |
| 306 | 305 | case ODataConstants::DATETIME_MINUTE: |
| 307 | - return self::TYPE_NAMESPACE . "DateTime::minute($params[0])"; |
|
| 306 | + return self::TYPE_NAMESPACE."DateTime::minute($params[0])"; |
|
| 308 | 307 | |
| 309 | 308 | case ODataConstants::DATETIME_SECOND: |
| 310 | - return self::TYPE_NAMESPACE . "DateTime::second($params[0])"; |
|
| 309 | + return self::TYPE_NAMESPACE."DateTime::second($params[0])"; |
|
| 311 | 310 | |
| 312 | 311 | case ODataConstants::MATHFUN_ROUND: |
| 313 | 312 | return "round($params[0])"; |
@@ -319,7 +318,7 @@ discard block |
||
| 319 | 318 | return "floor($params[0])"; |
| 320 | 319 | |
| 321 | 320 | case ODataConstants::BINFUL_EQUAL: |
| 322 | - return self::TYPE_NAMESPACE . "Binary::binaryEqual($params[0], $params[1])"; |
|
| 321 | + return self::TYPE_NAMESPACE."Binary::binaryEqual($params[0], $params[1])"; |
|
| 323 | 322 | |
| 324 | 323 | case 'is_null': |
| 325 | 324 | return "is_null($params[0])"; |
@@ -341,7 +340,7 @@ discard block |
||
| 341 | 340 | private function _prepareBinaryExpression($operator, $left, $right) |
| 342 | 341 | { |
| 343 | 342 | return |
| 344 | - self::OPEN_BRACKET . $left . ' ' . $operator . ' ' . $right . self::CLOSE_BRACKET; |
|
| 343 | + self::OPEN_BRACKET.$left.' '.$operator.' '.$right.self::CLOSE_BRACKET; |
|
| 345 | 344 | } |
| 346 | 345 | |
| 347 | 346 | /** |
@@ -354,6 +353,6 @@ discard block |
||
| 354 | 353 | */ |
| 355 | 354 | private function _prepareUnaryExpression($operator, $child) |
| 356 | 355 | { |
| 357 | - return $operator . self::OPEN_BRACKET . $child . self::CLOSE_BRACKET; |
|
| 356 | + return $operator.self::OPEN_BRACKET.$child.self::CLOSE_BRACKET; |
|
| 358 | 357 | } |
| 359 | 358 | } |
| 360 | 359 | \ No newline at end of file |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | /** |
| 275 | 275 | * To set custom state object for this type |
| 276 | 276 | * |
| 277 | - * @param Object $object The custom object. |
|
| 277 | + * @param ResourceSet $object The custom object. |
|
| 278 | 278 | * |
| 279 | 279 | * @return void |
| 280 | 280 | */ |
@@ -696,7 +696,7 @@ discard block |
||
| 696 | 696 | * |
| 697 | 697 | * @param array &$arrayToDetectLoopInComplexType array for detecting loop. |
| 698 | 698 | * |
| 699 | - * @return boolean true if resource type instance has bag property else false |
|
| 699 | + * @return boolean|null true if resource type instance has bag property else false |
|
| 700 | 700 | */ |
| 701 | 701 | public function hasBagProperty(&$arrayToDetectLoopInComplexType) |
| 702 | 702 | { |
@@ -15,12 +15,10 @@ |
||
| 15 | 15 | use POData\Providers\Metadata\Type\SByte; |
| 16 | 16 | use POData\Providers\Metadata\Type\Single; |
| 17 | 17 | use POData\Providers\Metadata\Type\String; |
| 18 | -use POData\Providers\Metadata\Type\TypeCode; |
|
| 19 | 18 | use POData\Providers\Metadata\Type\EdmPrimitiveType; |
| 20 | 19 | use POData\Providers\Metadata\Type\IType; |
| 21 | 20 | use POData\Common\Messages; |
| 22 | 21 | use POData\Common\InvalidOperationException; |
| 23 | -use POData\Common; |
|
| 24 | 22 | |
| 25 | 23 | /** |
| 26 | 24 | * Class ResourceType |
@@ -194,9 +194,9 @@ |
||
| 194 | 194 | * @throws \InvalidArgumentException |
| 195 | 195 | */ |
| 196 | 196 | public function __construct( |
| 197 | - $instanceType, |
|
| 198 | - $resourceTypeKind, |
|
| 199 | - $name, |
|
| 197 | + $instanceType, |
|
| 198 | + $resourceTypeKind, |
|
| 199 | + $name, |
|
| 200 | 200 | $namespaceName = null, |
| 201 | 201 | ResourceType $baseType = null, |
| 202 | 202 | $isAbstract = false |
@@ -826,102 +826,102 @@ |
||
| 826 | 826 | public static function getPrimitiveResourceType($typeCode) |
| 827 | 827 | { |
| 828 | 828 | switch($typeCode) { |
| 829 | - case EdmPrimitiveType::BINARY: |
|
| 830 | - return new ResourceType( |
|
| 831 | - new Binary(), ResourceTypeKind::PRIMITIVE, |
|
| 832 | - 'Binary', 'Edm' |
|
| 833 | - ); |
|
| 834 | - break; |
|
| 835 | - case EdmPrimitiveType::BOOLEAN: |
|
| 836 | - return new ResourceType( |
|
| 837 | - new Boolean(), |
|
| 838 | - ResourceTypeKind::PRIMITIVE, |
|
| 839 | - 'Boolean', 'Edm' |
|
| 840 | - ); |
|
| 841 | - break; |
|
| 842 | - case EdmPrimitiveType::BYTE: |
|
| 843 | - return new ResourceType( |
|
| 844 | - new Byte(), |
|
| 845 | - ResourceTypeKind::PRIMITIVE, |
|
| 846 | - 'Byte', 'Edm' |
|
| 847 | - ); |
|
| 848 | - break; |
|
| 849 | - case EdmPrimitiveType::DATETIME: |
|
| 850 | - return new ResourceType( |
|
| 851 | - new DateTime(), |
|
| 852 | - ResourceTypeKind::PRIMITIVE, |
|
| 853 | - 'DateTime', 'Edm' |
|
| 854 | - ); |
|
| 855 | - break; |
|
| 856 | - case EdmPrimitiveType::DECIMAL: |
|
| 857 | - return new ResourceType( |
|
| 858 | - new Decimal(), |
|
| 859 | - ResourceTypeKind::PRIMITIVE, |
|
| 860 | - 'Decimal', 'Edm' |
|
| 861 | - ); |
|
| 862 | - break; |
|
| 863 | - case EdmPrimitiveType::DOUBLE: |
|
| 864 | - return new ResourceType( |
|
| 865 | - new Double(), |
|
| 866 | - ResourceTypeKind::PRIMITIVE, |
|
| 867 | - 'Double', 'Edm' |
|
| 868 | - ); |
|
| 869 | - break; |
|
| 870 | - case EdmPrimitiveType::GUID: |
|
| 871 | - return new ResourceType( |
|
| 872 | - new Guid(), |
|
| 873 | - ResourceTypeKind::PRIMITIVE, |
|
| 874 | - 'Guid', 'Edm' |
|
| 875 | - ); |
|
| 876 | - break; |
|
| 877 | - case EdmPrimitiveType::INT16: |
|
| 878 | - return new ResourceType( |
|
| 879 | - new Int16(), |
|
| 880 | - ResourceTypeKind::PRIMITIVE, |
|
| 881 | - 'Int16', 'Edm' |
|
| 882 | - ); |
|
| 883 | - break; |
|
| 884 | - case EdmPrimitiveType::INT32: |
|
| 885 | - return new ResourceType( |
|
| 886 | - new Int32(), |
|
| 887 | - ResourceTypeKind::PRIMITIVE, |
|
| 888 | - 'Int32', 'Edm' |
|
| 889 | - ); |
|
| 890 | - break; |
|
| 891 | - case EdmPrimitiveType::INT64: |
|
| 892 | - return new ResourceType( |
|
| 893 | - new Int64(), |
|
| 894 | - ResourceTypeKind::PRIMITIVE, |
|
| 895 | - 'Int64', 'Edm' |
|
| 896 | - ); |
|
| 897 | - break; |
|
| 898 | - case EdmPrimitiveType::SBYTE: |
|
| 899 | - return new ResourceType( |
|
| 900 | - new SByte(), |
|
| 901 | - ResourceTypeKind::PRIMITIVE, |
|
| 902 | - 'SByte', 'Edm' |
|
| 903 | - ); |
|
| 904 | - break; |
|
| 905 | - case EdmPrimitiveType::SINGLE: |
|
| 906 | - return new ResourceType( |
|
| 907 | - new Single(), |
|
| 908 | - ResourceTypeKind::PRIMITIVE, |
|
| 909 | - 'Single', 'Edm' |
|
| 910 | - ); |
|
| 911 | - break; |
|
| 912 | - case EdmPrimitiveType::STRING: |
|
| 913 | - return new ResourceType( |
|
| 914 | - new String(), |
|
| 915 | - ResourceTypeKind::PRIMITIVE, |
|
| 916 | - 'String', 'Edm' |
|
| 917 | - ); |
|
| 918 | - break; |
|
| 919 | - default: |
|
| 920 | - throw new \InvalidArgumentException( |
|
| 921 | - Messages::commonNotValidPrimitiveEDMType( |
|
| 922 | - '$typeCode', 'getPrimitiveResourceType' |
|
| 923 | - ) |
|
| 924 | - ); |
|
| 829 | + case EdmPrimitiveType::BINARY: |
|
| 830 | + return new ResourceType( |
|
| 831 | + new Binary(), ResourceTypeKind::PRIMITIVE, |
|
| 832 | + 'Binary', 'Edm' |
|
| 833 | + ); |
|
| 834 | + break; |
|
| 835 | + case EdmPrimitiveType::BOOLEAN: |
|
| 836 | + return new ResourceType( |
|
| 837 | + new Boolean(), |
|
| 838 | + ResourceTypeKind::PRIMITIVE, |
|
| 839 | + 'Boolean', 'Edm' |
|
| 840 | + ); |
|
| 841 | + break; |
|
| 842 | + case EdmPrimitiveType::BYTE: |
|
| 843 | + return new ResourceType( |
|
| 844 | + new Byte(), |
|
| 845 | + ResourceTypeKind::PRIMITIVE, |
|
| 846 | + 'Byte', 'Edm' |
|
| 847 | + ); |
|
| 848 | + break; |
|
| 849 | + case EdmPrimitiveType::DATETIME: |
|
| 850 | + return new ResourceType( |
|
| 851 | + new DateTime(), |
|
| 852 | + ResourceTypeKind::PRIMITIVE, |
|
| 853 | + 'DateTime', 'Edm' |
|
| 854 | + ); |
|
| 855 | + break; |
|
| 856 | + case EdmPrimitiveType::DECIMAL: |
|
| 857 | + return new ResourceType( |
|
| 858 | + new Decimal(), |
|
| 859 | + ResourceTypeKind::PRIMITIVE, |
|
| 860 | + 'Decimal', 'Edm' |
|
| 861 | + ); |
|
| 862 | + break; |
|
| 863 | + case EdmPrimitiveType::DOUBLE: |
|
| 864 | + return new ResourceType( |
|
| 865 | + new Double(), |
|
| 866 | + ResourceTypeKind::PRIMITIVE, |
|
| 867 | + 'Double', 'Edm' |
|
| 868 | + ); |
|
| 869 | + break; |
|
| 870 | + case EdmPrimitiveType::GUID: |
|
| 871 | + return new ResourceType( |
|
| 872 | + new Guid(), |
|
| 873 | + ResourceTypeKind::PRIMITIVE, |
|
| 874 | + 'Guid', 'Edm' |
|
| 875 | + ); |
|
| 876 | + break; |
|
| 877 | + case EdmPrimitiveType::INT16: |
|
| 878 | + return new ResourceType( |
|
| 879 | + new Int16(), |
|
| 880 | + ResourceTypeKind::PRIMITIVE, |
|
| 881 | + 'Int16', 'Edm' |
|
| 882 | + ); |
|
| 883 | + break; |
|
| 884 | + case EdmPrimitiveType::INT32: |
|
| 885 | + return new ResourceType( |
|
| 886 | + new Int32(), |
|
| 887 | + ResourceTypeKind::PRIMITIVE, |
|
| 888 | + 'Int32', 'Edm' |
|
| 889 | + ); |
|
| 890 | + break; |
|
| 891 | + case EdmPrimitiveType::INT64: |
|
| 892 | + return new ResourceType( |
|
| 893 | + new Int64(), |
|
| 894 | + ResourceTypeKind::PRIMITIVE, |
|
| 895 | + 'Int64', 'Edm' |
|
| 896 | + ); |
|
| 897 | + break; |
|
| 898 | + case EdmPrimitiveType::SBYTE: |
|
| 899 | + return new ResourceType( |
|
| 900 | + new SByte(), |
|
| 901 | + ResourceTypeKind::PRIMITIVE, |
|
| 902 | + 'SByte', 'Edm' |
|
| 903 | + ); |
|
| 904 | + break; |
|
| 905 | + case EdmPrimitiveType::SINGLE: |
|
| 906 | + return new ResourceType( |
|
| 907 | + new Single(), |
|
| 908 | + ResourceTypeKind::PRIMITIVE, |
|
| 909 | + 'Single', 'Edm' |
|
| 910 | + ); |
|
| 911 | + break; |
|
| 912 | + case EdmPrimitiveType::STRING: |
|
| 913 | + return new ResourceType( |
|
| 914 | + new String(), |
|
| 915 | + ResourceTypeKind::PRIMITIVE, |
|
| 916 | + 'String', 'Edm' |
|
| 917 | + ); |
|
| 918 | + break; |
|
| 919 | + default: |
|
| 920 | + throw new \InvalidArgumentException( |
|
| 921 | + Messages::commonNotValidPrimitiveEDMType( |
|
| 922 | + '$typeCode', 'getPrimitiveResourceType' |
|
| 923 | + ) |
|
| 924 | + ); |
|
| 925 | 925 | } |
| 926 | 926 | } |
| 927 | 927 | } |
| 928 | 928 | \ No newline at end of file |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | $this->_baseType = $baseType; |
| 234 | 234 | $this->_namespaceName = $namespaceName; |
| 235 | 235 | $this->_fullName |
| 236 | - = is_null($namespaceName) ? $name : $namespaceName . '.' . $name; |
|
| 236 | + = is_null($namespaceName) ? $name : $namespaceName.'.'.$name; |
|
| 237 | 237 | $this->_abstractType = $isAbstract; |
| 238 | 238 | $this->_isMediaLinkEntry = false; |
| 239 | 239 | $this->_customState = null; |
@@ -825,7 +825,7 @@ discard block |
||
| 825 | 825 | */ |
| 826 | 826 | public static function getPrimitiveResourceType($typeCode) |
| 827 | 827 | { |
| 828 | - switch($typeCode) { |
|
| 828 | + switch ($typeCode) { |
|
| 829 | 829 | case EdmPrimitiveType::BINARY: |
| 830 | 830 | return new ResourceType( |
| 831 | 831 | new Binary(), ResourceTypeKind::PRIMITIVE, |