@@ -1,17 +1,8 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | use POData\Providers\Metadata\ResourceStreamInfo; |
| 4 | -use POData\Providers\Metadata\ResourceAssociationSetEnd; |
|
| 5 | -use POData\Providers\Metadata\ResourceAssociationSet; |
|
| 6 | -use POData\Common\NotImplementedException; |
|
| 7 | 4 | use POData\Providers\Metadata\Type\EdmPrimitiveType; |
| 8 | -use POData\Providers\Metadata\ResourceSet; |
|
| 9 | -use POData\Providers\Metadata\ResourcePropertyKind; |
|
| 10 | -use POData\Providers\Metadata\ResourceProperty; |
|
| 11 | -use POData\Providers\Metadata\ResourceTypeKind; |
|
| 12 | -use POData\Providers\Metadata\ResourceType; |
|
| 13 | 5 | use POData\Common\InvalidOperationException; |
| 14 | -use POData\Providers\Metadata\IMetadataProvider; |
|
| 15 | 6 | require_once 'POData\Providers\Metadata\IDataServiceMetadataProvider.php'; |
| 16 | 7 | use POData\Providers\Metadata\SimpleMetadataProvider; |
| 17 | 8 | //Begin Resource Classes |
@@ -8,11 +8,6 @@ |
||
| 8 | 8 | use POData\Configuration\ProtocolVersion; |
| 9 | 9 | use POData\Configuration\ServiceConfiguration; |
| 10 | 10 | use POData\BaseService; |
| 11 | -use POData\OperationContext\ServiceHost; |
|
| 12 | -use POData\Common\ODataException; |
|
| 13 | -use POData\Common\ODataConstants; |
|
| 14 | -use POData\Common\Messages; |
|
| 15 | -use POData\UriProcessor\UriProcessor; |
|
| 16 | 11 | require_once 'WordPressMetadata.php'; |
| 17 | 12 | require_once 'WordPressQueryProvider.php'; |
| 18 | 13 | require_once 'WordPressDSExpressionProvider.php'; |
@@ -53,7 +53,7 @@ |
||
| 53 | 53 | */ |
| 54 | 54 | public function getService($serviceType) |
| 55 | 55 | { |
| 56 | - if(($serviceType === 'IMetadataProvider') || |
|
| 56 | + if (($serviceType === 'IMetadataProvider') || |
|
| 57 | 57 | ($serviceType === 'IQueryProvider') || |
| 58 | 58 | ($serviceType === 'IStreamProvider')) { |
| 59 | 59 | if (is_null($this->_wordPressExpressionProvider)) { |
@@ -2,7 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | use POData\UriProcessor\QueryProcessor\ExpressionParser\Expressions\ExpressionType; |
| 4 | 4 | use POData\Providers\Metadata\Type\IType; |
| 5 | -use POData\Common\NotImplementedException; |
|
| 6 | 5 | use POData\Common\ODataConstants; |
| 7 | 6 | use POData\Providers\Expression\IExpressionProvider; |
| 8 | 7 | use POData\Providers\Metadata\ResourceType; |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | public function onLogicalExpression($expressionType, $left, $right) |
| 86 | 86 | { |
| 87 | - switch($expressionType) { |
|
| 87 | + switch ($expressionType) { |
|
| 88 | 88 | case ExpressionType::AND_LOGICAL: |
| 89 | 89 | return $this->_prepareBinaryExpression(self::LOGICAL_AND, $left, $right); |
| 90 | 90 | break; |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | */ |
| 108 | 108 | public function onArithmeticExpression($expressionType, $left, $right) |
| 109 | 109 | { |
| 110 | - switch($expressionType) { |
|
| 110 | + switch ($expressionType) { |
|
| 111 | 111 | case ExpressionType::MULTIPLY: |
| 112 | 112 | return $this->_prepareBinaryExpression(self::MULTIPLY, $left, $right); |
| 113 | 113 | break; |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | */ |
| 140 | 140 | public function onRelationalExpression($expressionType, $left, $right) |
| 141 | 141 | { |
| 142 | - switch($expressionType) { |
|
| 142 | + switch ($expressionType) { |
|
| 143 | 143 | case ExpressionType::GREATERTHAN: |
| 144 | 144 | return $this->_prepareBinaryExpression(self::GREATERTHAN, $left, $right); |
| 145 | 145 | break; |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | */ |
| 178 | 178 | public function onUnaryExpression($expressionType, $child) |
| 179 | 179 | { |
| 180 | - switch($expressionType) { |
|
| 180 | + switch ($expressionType) { |
|
| 181 | 181 | case ExpressionType::NEGATE: |
| 182 | 182 | return $this->_prepareUnaryExpression(self::NEGATE, $child); |
| 183 | 183 | break; |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | */ |
| 244 | 244 | public function onFunctionCallExpression($functionDescription, $params) |
| 245 | 245 | { |
| 246 | - switch($functionDescription->functionName) { |
|
| 246 | + switch ($functionDescription->functionName) { |
|
| 247 | 247 | case ODataConstants::STRFUN_COMPARE: |
| 248 | 248 | return "STRCMP($params[0], $params[1])"; |
| 249 | 249 | break; |
@@ -270,8 +270,7 @@ discard block |
||
| 270 | 270 | break; |
| 271 | 271 | case ODataConstants::STRFUN_SUBSTRING: |
| 272 | 272 | return count($params) == 3 ? |
| 273 | - "SUBSTRING($params[0], $params[1] + 1, $params[2])" : |
|
| 274 | - "SUBSTRING($params[0], $params[1] + 1)"; |
|
| 273 | + "SUBSTRING($params[0], $params[1] + 1, $params[2])" : "SUBSTRING($params[0], $params[1] + 1)"; |
|
| 275 | 274 | break; |
| 276 | 275 | case ODataConstants::STRFUN_SUBSTRINGOF: |
| 277 | 276 | return "(LOCATE($params[0], $params[1]) > 0)"; |
@@ -343,14 +342,14 @@ discard block |
||
| 343 | 342 | $str = explode(';', $left, 2); |
| 344 | 343 | $str[0] = str_replace('DATETIMECMP', '', $str[0]); |
| 345 | 344 | return self::OPEN_BRAKET |
| 346 | - . $str[0] . ' ' . $operator |
|
| 347 | - . ' ' . $str[1] . self::CLOSE_BRACKET; |
|
| 345 | + . $str[0].' '.$operator |
|
| 346 | + . ' '.$str[1].self::CLOSE_BRACKET; |
|
| 348 | 347 | } |
| 349 | 348 | |
| 350 | 349 | return |
| 351 | 350 | self::OPEN_BRAKET |
| 352 | - . $left . ' ' . $operator |
|
| 353 | - . ' ' . $right . self::CLOSE_BRACKET; |
|
| 351 | + . $left.' '.$operator |
|
| 352 | + . ' '.$right.self::CLOSE_BRACKET; |
|
| 354 | 353 | } |
| 355 | 354 | |
| 356 | 355 | /** |
@@ -363,6 +362,6 @@ discard block |
||
| 363 | 362 | */ |
| 364 | 363 | private function _prepareUnaryExpression($operator, $child) |
| 365 | 364 | { |
| 366 | - return $operator . self::OPEN_BRAKET . $child . self::CLOSE_BRACKET; |
|
| 365 | + return $operator.self::OPEN_BRAKET.$child.self::CLOSE_BRACKET; |
|
| 367 | 366 | } |
| 368 | 367 | } |
@@ -1,20 +1,9 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -use POData\Providers\Metadata\ResourceStreamInfo; |
|
| 4 | -use POData\Providers\Metadata\ResourceAssociationSetEnd; |
|
| 5 | -use POData\Providers\Metadata\ResourceAssociationSet; |
|
| 6 | -use POData\Common\NotImplementedException; |
|
| 7 | 3 | use POData\Providers\Metadata\Type\EdmPrimitiveType; |
| 8 | -use POData\Providers\Metadata\ResourceSet; |
|
| 9 | -use POData\Providers\Metadata\ResourcePropertyKind; |
|
| 10 | -use POData\Providers\Metadata\ResourceProperty; |
|
| 11 | -use POData\Providers\Metadata\ResourceTypeKind; |
|
| 12 | -use POData\Providers\Metadata\ResourceType; |
|
| 13 | 4 | use POData\Common\InvalidOperationException; |
| 14 | -use POData\Providers\Metadata\IMetadataProvider; |
|
| 15 | 5 | require_once 'POData\Providers\Metadata\IDataServiceMetadataProvider.php'; |
| 16 | 6 | use POData\Providers\Metadata\SimpleMetadataProvider; |
| 17 | -use POData\Providers\Metadata\MetadataMapping; |
|
| 18 | 7 | |
| 19 | 8 | //Begin Resource Classes |
| 20 | 9 | |
@@ -297,8 +297,8 @@ discard block |
||
| 297 | 297 | public static function getEntityMapping() { |
| 298 | 298 | if (!is_null(self::$_entityMapping)) |
| 299 | 299 | { |
| 300 | - self::$_entityMapping = array ( |
|
| 301 | - 'Post' => array ( |
|
| 300 | + self::$_entityMapping = array( |
|
| 301 | + 'Post' => array( |
|
| 302 | 302 | '$MappedTable$' => 'wp_posts', |
| 303 | 303 | 'PostID' => 'ID', |
| 304 | 304 | 'Author' => 'post_author', |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | 'CommentCount' => 'comment_count' |
| 325 | 325 | ), |
| 326 | 326 | |
| 327 | - 'Tag' => array ( |
|
| 327 | + 'Tag' => array( |
|
| 328 | 328 | '$MappedTable$' => 'wp_terms', |
| 329 | 329 | 'TagID' =>'t.term_id', |
| 330 | 330 | 'Name' =>'t.name', |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | 'Description' =>'tt.description' |
| 333 | 333 | ), |
| 334 | 334 | |
| 335 | - 'Category' => array ( |
|
| 335 | + 'Category' => array( |
|
| 336 | 336 | '$MappedTable$' => 'wp_terms', |
| 337 | 337 | 'CategoryID' =>'t.term_id', |
| 338 | 338 | 'Name' =>'t.name', |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | 'Description' =>'tt.description' |
| 341 | 341 | ), |
| 342 | 342 | |
| 343 | - 'Comment' => array ( |
|
| 343 | + 'Comment' => array( |
|
| 344 | 344 | '$MappedTable$' => 'wp_comments', |
| 345 | 345 | 'CommentID', 'comment_id', |
| 346 | 346 | 'PostID', 'comment_post_id', |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | 'UserID', 'user_id' |
| 359 | 359 | ), |
| 360 | 360 | |
| 361 | - 'User' => array ( |
|
| 361 | + 'User' => array( |
|
| 362 | 362 | '$MappedTable$' => 'wp_users', |
| 363 | 363 | 'UserID' => 'ID', |
| 364 | 364 | 'Login' => 'user_login', |
@@ -5,7 +5,6 @@ discard block |
||
| 5 | 5 | use POData\Common\MimeTypes; |
| 6 | 6 | use POData\Common\Version; |
| 7 | 7 | use POData\OperationContext\HTTPRequestMethod; |
| 8 | -use POData\Providers\Metadata\ResourceTypeKind; |
|
| 9 | 8 | use POData\Common\ErrorHandler; |
| 10 | 9 | use POData\Common\Messages; |
| 11 | 10 | use POData\Common\ODataException; |
@@ -30,11 +29,9 @@ discard block |
||
| 30 | 29 | use POData\Writers\Json\JsonODataV1Writer; |
| 31 | 30 | use POData\Writers\Json\JsonODataV2Writer; |
| 32 | 31 | use POData\Writers\ResponseWriter; |
| 33 | - |
|
| 34 | 32 | use POData\Providers\Query\IQueryProvider; |
| 35 | 33 | use POData\Providers\Metadata\IMetadataProvider; |
| 36 | 34 | use POData\OperationContext\IOperationContext; |
| 37 | - |
|
| 38 | 35 | use POData\Writers\ODataWriterRegistry; |
| 39 | 36 | |
| 40 | 37 | /** |
@@ -316,11 +316,11 @@ discard block |
||
| 316 | 316 | $registry->register(new JsonODataV1Writer()); |
| 317 | 317 | $registry->register(new AtomODataWriter($serviceURI)); |
| 318 | 318 | |
| 319 | - if($serviceVersion->compare(Version::v2()) > -1){ |
|
| 319 | + if ($serviceVersion->compare(Version::v2()) > -1) { |
|
| 320 | 320 | $registry->register(new JsonODataV2Writer()); |
| 321 | 321 | } |
| 322 | 322 | |
| 323 | - if($serviceVersion->compare(Version::v3()) > -1){ |
|
| 323 | + if ($serviceVersion->compare(Version::v3()) > -1) { |
|
| 324 | 324 | $registry->register(new JsonLightODataWriter(JsonLightMetadataLevel::NONE(), $serviceURI)); |
| 325 | 325 | $registry->register(new JsonLightODataWriter(JsonLightMetadataLevel::MINIMAL(), $serviceURI)); |
| 326 | 326 | $registry->register(new JsonLightODataWriter(JsonLightMetadataLevel::FULL(), $serviceURI)); |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | |
| 352 | 352 | if (is_null($responseContentType) && $request->getTargetKind() != TargetKind::MEDIA_RESOURCE()) { |
| 353 | 353 | //the responseContentType can ONLY be null if it's a stream (media resource) and that stream is storing null as the content type |
| 354 | - throw new ODataException( Messages::unsupportedMediaType(), 415 ); |
|
| 354 | + throw new ODataException(Messages::unsupportedMediaType(), 415); |
|
| 355 | 355 | } |
| 356 | 356 | |
| 357 | 357 | $odataModelInstance = null; |
@@ -518,10 +518,10 @@ discard block |
||
| 518 | 518 | |
| 519 | 519 | //if the $format header is present it overrides the accepts header |
| 520 | 520 | $format = $host->getQueryStringItem(ODataConstants::HTTPQUERY_STRING_FORMAT); |
| 521 | - if(!is_null($format)){ |
|
| 521 | + if (!is_null($format)) { |
|
| 522 | 522 | |
| 523 | 523 | //There's a strange edge case..if application/json is supplied and it's V3 |
| 524 | - if($format == MimeTypes::MIME_APPLICATION_JSON && $requestVersion == Version::v3()){ |
|
| 524 | + if ($format == MimeTypes::MIME_APPLICATION_JSON && $requestVersion == Version::v3()) { |
|
| 525 | 525 | //then it's actual minimalmetadata |
| 526 | 526 | //TODO: should this be done with the header text too? |
| 527 | 527 | $format = MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META; |
@@ -537,7 +537,7 @@ discard block |
||
| 537 | 537 | //getTargetKind doesn't deal with link resources directly and this can change things |
| 538 | 538 | $targetKind = $request->isLinkUri() ? TargetKind::LINK() : $request->getTargetKind(); |
| 539 | 539 | |
| 540 | - switch($targetKind){ |
|
| 540 | + switch ($targetKind) { |
|
| 541 | 541 | case TargetKind::METADATA(): |
| 542 | 542 | return HttpProcessUtility::selectMimeType( |
| 543 | 543 | $requestAcceptText, |
@@ -614,7 +614,7 @@ discard block |
||
| 614 | 614 | ); |
| 615 | 615 | |
| 616 | 616 | case TargetKind::MEDIA_RESOURCE(): |
| 617 | - if (!$request->isNamedStream() && !$request->getTargetResourceType()->isMediaLinkEntry()){ |
|
| 617 | + if (!$request->isNamedStream() && !$request->getTargetResourceType()->isMediaLinkEntry()) { |
|
| 618 | 618 | throw ODataException::createBadRequestError( |
| 619 | 619 | Messages::badRequestInvalidUriForMediaResource( |
| 620 | 620 | $host->getAbsoluteRequestUri()->getUrlAsString() |
@@ -648,7 +648,7 @@ discard block |
||
| 648 | 648 | |
| 649 | 649 | |
| 650 | 650 | //If we got here, we just don't know what it is... |
| 651 | - throw new ODataException( Messages::unsupportedMediaType(), 415 ); |
|
| 651 | + throw new ODataException(Messages::unsupportedMediaType(), 415); |
|
| 652 | 652 | |
| 653 | 653 | } |
| 654 | 654 | |
@@ -669,7 +669,7 @@ discard block |
||
| 669 | 669 | * @return string|null The ETag for the entry object if it has eTag properties |
| 670 | 670 | * NULL otherwise. |
| 671 | 671 | */ |
| 672 | - protected function compareETag(&$entryObject, ResourceType &$resourceType, |
|
| 672 | + protected function compareETag(&$entryObject, ResourceType & $resourceType, |
|
| 673 | 673 | &$needToSerializeResponse |
| 674 | 674 | ) { |
| 675 | 675 | $needToSerializeResponse = true; |
@@ -720,7 +720,7 @@ discard block |
||
| 720 | 720 | // but that is causing an issue in Linux env where the |
| 721 | 721 | // firefix browser is unable to parse the ETag in this case. |
| 722 | 722 | // Need to follow up PHP core devs for this. |
| 723 | - $eTag = ODataConstants::HTTP_WEAK_ETAG_PREFIX . $eTag . '"'; |
|
| 723 | + $eTag = ODataConstants::HTTP_WEAK_ETAG_PREFIX.$eTag.'"'; |
|
| 724 | 724 | if (!is_null($ifMatch)) { |
| 725 | 725 | if (strcmp($eTag, $ifMatch) != 0) { |
| 726 | 726 | // Requested If-Match value does not match with current |
@@ -743,7 +743,7 @@ discard block |
||
| 743 | 743 | // but that is causing an issue in Linux env where the |
| 744 | 744 | // firefix browser is unable to parse the ETag in this case. |
| 745 | 745 | // Need to follow up PHP core devs for this. |
| 746 | - $eTag = ODataConstants::HTTP_WEAK_ETAG_PREFIX . $eTag . '"'; |
|
| 746 | + $eTag = ODataConstants::HTTP_WEAK_ETAG_PREFIX.$eTag.'"'; |
|
| 747 | 747 | } |
| 748 | 748 | |
| 749 | 749 | return $eTag; |
@@ -762,7 +762,7 @@ discard block |
||
| 762 | 762 | * for use in a URI) there are etag properties, NULL if |
| 763 | 763 | * there is no etag property. |
| 764 | 764 | */ |
| 765 | - protected function getETagForEntry(&$entryObject, ResourceType &$resourceType) |
|
| 765 | + protected function getETagForEntry(&$entryObject, ResourceType & $resourceType) |
|
| 766 | 766 | { |
| 767 | 767 | $eTag = null; |
| 768 | 768 | $comma = null; |
@@ -777,18 +777,18 @@ discard block |
||
| 777 | 777 | try { |
| 778 | 778 | |
| 779 | 779 | //TODO #88...also this seems like dupe work |
| 780 | - $reflectionProperty = new \ReflectionProperty($entryObject, $eTagProperty->getName() ); |
|
| 780 | + $reflectionProperty = new \ReflectionProperty($entryObject, $eTagProperty->getName()); |
|
| 781 | 781 | $value = $reflectionProperty->getValue($entryObject); |
| 782 | 782 | } catch (\ReflectionException $reflectionException) { |
| 783 | 783 | throw ODataException::createInternalServerError( |
| 784 | - Messages::failedToAccessProperty($eTagProperty->getName(), $resourceType->getName() ) |
|
| 784 | + Messages::failedToAccessProperty($eTagProperty->getName(), $resourceType->getName()) |
|
| 785 | 785 | ); |
| 786 | 786 | } |
| 787 | 787 | |
| 788 | 788 | if (is_null($value)) { |
| 789 | - $eTag = $eTag . $comma. 'null'; |
|
| 789 | + $eTag = $eTag.$comma.'null'; |
|
| 790 | 790 | } else { |
| 791 | - $eTag = $eTag . $comma . $type->convertToOData($value); |
|
| 791 | + $eTag = $eTag.$comma.$type->convertToOData($value); |
|
| 792 | 792 | } |
| 793 | 793 | |
| 794 | 794 | $comma = ','; |
@@ -4,9 +4,7 @@ |
||
| 4 | 4 | |
| 5 | 5 | |
| 6 | 6 | use POData\Writers\Json\JsonODataV2Writer; |
| 7 | - |
|
| 8 | 7 | use POData\Writers\Atom\AtomODataWriter; |
| 9 | -use POData\BaseService; |
|
| 10 | 8 | use POData\HttpProcessUtility; |
| 11 | 9 | use POData\IService; |
| 12 | 10 | |
@@ -53,7 +53,7 @@ |
||
| 53 | 53 | $exception = new ODataException($exception->getMessage(), HttpStatus::CODE_INTERNAL_SERVER_ERROR); |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - $service->getHost()->setResponseVersion(ODataConstants::DATASERVICEVERSION_1_DOT_0 . ';'); |
|
| 56 | + $service->getHost()->setResponseVersion(ODataConstants::DATASERVICEVERSION_1_DOT_0.';'); |
|
| 57 | 57 | |
| 58 | 58 | // At this point all kind of exceptions will be converted |
| 59 | 59 | //to 'ODataException' |
@@ -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; |
@@ -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++) { |
@@ -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; |
@@ -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; |
@@ -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 | |