@@ -79,7 +79,7 @@ |
||
| 79 | 79 | */ |
| 80 | 80 | public function register() |
| 81 | 81 | { |
| 82 | - $this->app->singleton('metadataControllers', function ($app) { |
|
| 82 | + $this->app->singleton('metadataControllers', function($app) { |
|
| 83 | 83 | return new MetadataControllerContainer(); |
| 84 | 84 | }); |
| 85 | 85 | } |
@@ -3,9 +3,7 @@ |
||
| 3 | 3 | namespace AlgoWeb\PODataLaravel\Providers; |
| 4 | 4 | |
| 5 | 5 | use AlgoWeb\PODataLaravel\Controllers\MetadataControllerTrait; |
| 6 | -use AlgoWeb\PODataLaravel\Controllers\TestController; |
|
| 7 | 6 | use Illuminate\Routing\Controller; |
| 8 | -use Illuminate\Support\ServiceProvider; |
|
| 9 | 7 | use Illuminate\Support\Facades\Cache; |
| 10 | 8 | use AlgoWeb\PODataLaravel\Controllers\MetadataControllerContainer; |
| 11 | 9 | use Illuminate\Support\Facades\App; |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | */ |
| 25 | 25 | public function register() |
| 26 | 26 | { |
| 27 | - $this->app->singleton('odataquery', function ($app) { |
|
| 27 | + $this->app->singleton('odataquery', function($app) { |
|
| 28 | 28 | return new LaravelQuery(); |
| 29 | 29 | }); |
| 30 | 30 | } |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | } |
| 316 | 316 | /** |
| 317 | 317 | * Delete resource from a resource set. |
| 318 | - * @param ResourceSet|null $sourceResourceSet |
|
| 318 | + * @param ResourceSet $sourceResourceSet |
|
| 319 | 319 | * @param object $sourceEntityInstance |
| 320 | 320 | * |
| 321 | 321 | * return bool true if resources sucessfully deteled, otherwise false. |
@@ -460,7 +460,7 @@ discard block |
||
| 460 | 460 | * @param ResourceSet $sourceResourceSet |
| 461 | 461 | * @param $sourceEntityInstance |
| 462 | 462 | * @param $data |
| 463 | - * @param $verb |
|
| 463 | + * @param string $verb |
|
| 464 | 464 | * @return mixed |
| 465 | 465 | * @throws ODataException |
| 466 | 466 | * @throws \POData\Common\InvalidOperationException |
@@ -490,7 +490,7 @@ |
||
| 490 | 490 | } |
| 491 | 491 | $outData = $result->getData(); |
| 492 | 492 | if (is_object($outData)) { |
| 493 | - $outData = (array)$outData; |
|
| 493 | + $outData = (array) $outData; |
|
| 494 | 494 | } |
| 495 | 495 | |
| 496 | 496 | if (!is_array($outData)) { |
@@ -414,8 +414,8 @@ |
||
| 414 | 414 | * @param $first |
| 415 | 415 | * @param $property |
| 416 | 416 | * @param $last |
| 417 | - * @param $mult |
|
| 418 | - * @param $targ |
|
| 417 | + * @param string $mult |
|
| 418 | + * @param string $targ |
|
| 419 | 419 | */ |
| 420 | 420 | private function addRelationsHook(&$hooks, $first, $property, $last, $mult, $targ) |
| 421 | 421 | { |
@@ -534,10 +534,10 @@ discard block |
||
| 534 | 534 | |
| 535 | 535 | $keyRaw = $isBelong ? $foo->$fkMethodName() : $foo->$fkMethodAlternate(); |
| 536 | 536 | $keySegments = explode('.', $keyRaw); |
| 537 | - $keyName = $keySegments[count($keySegments) - 1]; |
|
| 537 | + $keyName = $keySegments[count($keySegments)-1]; |
|
| 538 | 538 | $localRaw = $isBelong ? $foo->$rkMethodName() : $foo->$rkMethodAlternate(); |
| 539 | 539 | $localSegments = explode('.', $localRaw); |
| 540 | - $localName = $localSegments[count($localSegments) - 1]; |
|
| 540 | + $localName = $localSegments[count($localSegments)-1]; |
|
| 541 | 541 | $first = $keyName; |
| 542 | 542 | $last = $localName; |
| 543 | 543 | $this->addRelationsHook($hooks, $first, $property, $last, $mult, $targ); |
@@ -563,10 +563,10 @@ discard block |
||
| 563 | 563 | |
| 564 | 564 | $keyName = $isBelong ? $foo->$fkMethodName() : $foo->$fkMethodAlternate(); |
| 565 | 565 | $keySegments = explode('.', $keyName); |
| 566 | - $keyName = $keySegments[count($keySegments) - 1]; |
|
| 566 | + $keyName = $keySegments[count($keySegments)-1]; |
|
| 567 | 567 | $localRaw = $isBelong ? $foo->$rkMethodName() : $foo->$rkMethodAlternate(); |
| 568 | 568 | $localSegments = explode('.', $localRaw); |
| 569 | - $localName = $localSegments[count($localSegments) - 1]; |
|
| 569 | + $localName = $localSegments[count($localSegments)-1]; |
|
| 570 | 570 | $first = $isBelong ? $localName : $keyName; |
| 571 | 571 | $last = $isBelong ? $keyName : $localName; |
| 572 | 572 | $this->addRelationsHook($hooks, $first, $property, $last, $mult, $targ); |
@@ -590,10 +590,10 @@ discard block |
||
| 590 | 590 | |
| 591 | 591 | $keyRaw = $isMany ? $foo->$fkMethodName() : $foo->$fkMethodAlternate(); |
| 592 | 592 | $keySegments = explode('.', $keyRaw); |
| 593 | - $keyName = $keySegments[count($keySegments) - 1]; |
|
| 593 | + $keyName = $keySegments[count($keySegments)-1]; |
|
| 594 | 594 | $localRaw = $isMany ? $foo->$rkMethodName() : $foo->$rkMethodAlternate(); |
| 595 | 595 | $localSegments = explode('.', $localRaw); |
| 596 | - $localName = $localSegments[count($localSegments) - 1]; |
|
| 596 | + $localName = $localSegments[count($localSegments)-1]; |
|
| 597 | 597 | $first = $isMany ? $keyName : $localName; |
| 598 | 598 | $last = $isMany ? $localName : $keyName; |
| 599 | 599 | $this->addRelationsHook($hooks, $first, $property, $last, $mult, $targ); |
@@ -616,10 +616,10 @@ discard block |
||
| 616 | 616 | |
| 617 | 617 | $keyRaw = $isMany ? $foo->$fkMethodName() : $foo->$fkMethodAlternate(); |
| 618 | 618 | $keySegments = explode('.', $keyRaw); |
| 619 | - $keyName = $keySegments[count($keySegments) - 1]; |
|
| 619 | + $keyName = $keySegments[count($keySegments)-1]; |
|
| 620 | 620 | $localRaw = $isMany ? $foo->$rkMethodName() : $foo->$rkMethodAlternate(); |
| 621 | 621 | $localSegments = explode('.', $localRaw); |
| 622 | - $localName = $localSegments[count($localSegments) - 1]; |
|
| 622 | + $localName = $localSegments[count($localSegments)-1]; |
|
| 623 | 623 | |
| 624 | 624 | $first = $keyName; |
| 625 | 625 | $last = (isset($localName) && "" != $localName) ? $localName : $foo->getRelated()->getKeyName(); |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | class MetadataProvider extends MetadataBaseProvider |
| 14 | 14 | { |
| 15 | - protected $multConstraints = [ '0..1' => ['1'], '1' => ['0..1', '*'], '*' => ['1', '*']]; |
|
| 15 | + protected $multConstraints = ['0..1' => ['1'], '1' => ['0..1', '*'], '*' => ['1', '*']]; |
|
| 16 | 16 | protected static $METANAMESPACE = "Data"; |
| 17 | 17 | |
| 18 | 18 | /** |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | public function register() |
| 77 | 77 | { |
| 78 | - $this->app->singleton('metadata', function ($app) { |
|
| 78 | + $this->app->singleton('metadata', function($app) { |
|
| 79 | 79 | return new SimpleMetadataProvider('Data', self::$METANAMESPACE); |
| 80 | 80 | }); |
| 81 | 81 | } |
@@ -196,11 +196,11 @@ discard block |
||
| 196 | 196 | $dependentProperty = $foreign[$dependentType]['property']; |
| 197 | 197 | assert( |
| 198 | 198 | in_array($dependentMult, $this->multConstraints[$principalMult]), |
| 199 | - "Cannot pair multiplicities " . $dependentMult . " and " . $principalMult |
|
| 199 | + "Cannot pair multiplicities ".$dependentMult." and ".$principalMult |
|
| 200 | 200 | ); |
| 201 | 201 | assert( |
| 202 | 202 | in_array($principalMult, $this->multConstraints[$dependentMult]), |
| 203 | - "Cannot pair multiplicities " . $principalMult . " and " . $dependentMult |
|
| 203 | + "Cannot pair multiplicities ".$principalMult." and ".$dependentMult |
|
| 204 | 204 | ); |
| 205 | 205 | // generate forward and reverse relations |
| 206 | 206 | list($forward, $reverse) = $this->calculateRoundTripRelationsGenForwardReverse( |
@@ -244,11 +244,11 @@ discard block |
||
| 244 | 244 | $dependentProperty = $foreign['property']; |
| 245 | 245 | assert( |
| 246 | 246 | in_array($dependentMult, $this->multConstraints[$principalMult]), |
| 247 | - "Cannot pair multiplicities " . $dependentMult . " and " . $principalMult |
|
| 247 | + "Cannot pair multiplicities ".$dependentMult." and ".$principalMult |
|
| 248 | 248 | ); |
| 249 | 249 | assert( |
| 250 | 250 | in_array($principalMult, $this->multConstraints[$dependentMult]), |
| 251 | - "Cannot pair multiplicities " . $principalMult . " and " . $dependentMult |
|
| 251 | + "Cannot pair multiplicities ".$principalMult." and ".$dependentMult |
|
| 252 | 252 | ); |
| 253 | 253 | // generate forward and reverse relations |
| 254 | 254 | list($forward, $reverse) = $this->calculateRoundTripRelationsGenForwardReverse( |
@@ -3,12 +3,9 @@ |
||
| 3 | 3 | namespace AlgoWeb\PODataLaravel\Providers; |
| 4 | 4 | |
| 5 | 5 | use Illuminate\Support\Facades\App; |
| 6 | -use Illuminate\Support\ServiceProvider; |
|
| 7 | 6 | use Illuminate\Support\Facades\Cache; |
| 8 | 7 | use POData\Providers\Metadata\IMetadataProvider; |
| 9 | -use POData\Providers\Metadata\ResourceType; |
|
| 10 | 8 | use POData\Providers\Metadata\SimpleMetadataProvider; |
| 11 | -use Illuminate\Support\Facades\Route; |
|
| 12 | 9 | use Illuminate\Support\Facades\Schema as Schema; |
| 13 | 10 | |
| 14 | 11 | class MetadataProvider extends MetadataBaseProvider |
@@ -51,80 +51,80 @@ |
||
| 51 | 51 | */ |
| 52 | 52 | public function __construct() |
| 53 | 53 | { |
| 54 | - $this->functionDescriptionParsers[ODataConstants::STRFUN_COMPARE] = function ($params) { |
|
| 54 | + $this->functionDescriptionParsers[ODataConstants::STRFUN_COMPARE] = function($params) { |
|
| 55 | 55 | return "strcmp($params[0], $params[1])"; |
| 56 | 56 | }; |
| 57 | - $this->functionDescriptionParsers[ODataConstants::STRFUN_ENDSWITH] = function ($params) { |
|
| 57 | + $this->functionDescriptionParsers[ODataConstants::STRFUN_ENDSWITH] = function($params) { |
|
| 58 | 58 | return "(strcmp(substr($params[0], strlen($params[0]) - strlen($params[1])), $params[1]) === 0)"; |
| 59 | 59 | }; |
| 60 | - $this->functionDescriptionParsers[ODataConstants::STRFUN_INDEXOF] = function ($params) { |
|
| 60 | + $this->functionDescriptionParsers[ODataConstants::STRFUN_INDEXOF] = function($params) { |
|
| 61 | 61 | return "strpos($params[0], $params[1])"; |
| 62 | 62 | }; |
| 63 | - $this->functionDescriptionParsers[ODataConstants::STRFUN_REPLACE] = function ($params) { |
|
| 63 | + $this->functionDescriptionParsers[ODataConstants::STRFUN_REPLACE] = function($params) { |
|
| 64 | 64 | return "str_replace($params[1], $params[2], $params[0])"; |
| 65 | 65 | }; |
| 66 | - $this->functionDescriptionParsers[ODataConstants::STRFUN_STARTSWITH] = function ($params) { |
|
| 66 | + $this->functionDescriptionParsers[ODataConstants::STRFUN_STARTSWITH] = function($params) { |
|
| 67 | 67 | return "(strpos($params[0], $params[1]) === 0)"; |
| 68 | 68 | }; |
| 69 | - $this->functionDescriptionParsers[ODataConstants::STRFUN_TOLOWER] = function ($params) { |
|
| 69 | + $this->functionDescriptionParsers[ODataConstants::STRFUN_TOLOWER] = function($params) { |
|
| 70 | 70 | return "strtolower($params[0])"; |
| 71 | 71 | }; |
| 72 | - $this->functionDescriptionParsers[ODataConstants::STRFUN_TOUPPER] = function ($params) { |
|
| 72 | + $this->functionDescriptionParsers[ODataConstants::STRFUN_TOUPPER] = function($params) { |
|
| 73 | 73 | return "strtoupper($params[0])"; |
| 74 | 74 | }; |
| 75 | - $this->functionDescriptionParsers[ODataConstants::STRFUN_TRIM] = function ($params) { |
|
| 75 | + $this->functionDescriptionParsers[ODataConstants::STRFUN_TRIM] = function($params) { |
|
| 76 | 76 | return "trim($params[0])"; |
| 77 | 77 | }; |
| 78 | - $this->functionDescriptionParsers[ODataConstants::STRFUN_SUBSTRING] = function ($params) { |
|
| 78 | + $this->functionDescriptionParsers[ODataConstants::STRFUN_SUBSTRING] = function($params) { |
|
| 79 | 79 | return count($params) == 3 ? |
| 80 | 80 | "substr($params[0], $params[1], $params[2])" : "substr($params[0], $params[1])"; |
| 81 | 81 | }; |
| 82 | - $this->functionDescriptionParsers[ODataConstants::STRFUN_SUBSTRINGOF] = function ($params) { |
|
| 82 | + $this->functionDescriptionParsers[ODataConstants::STRFUN_SUBSTRINGOF] = function($params) { |
|
| 83 | 83 | return "(strpos($params[1], $params[0]) !== false)"; |
| 84 | 84 | }; |
| 85 | - $this->functionDescriptionParsers[ODataConstants::STRFUN_CONCAT] = function ($params) { |
|
| 85 | + $this->functionDescriptionParsers[ODataConstants::STRFUN_CONCAT] = function($params) { |
|
| 86 | 86 | return $params[0].' . '.$params[1]; |
| 87 | 87 | }; |
| 88 | - $this->functionDescriptionParsers[ODataConstants::STRFUN_LENGTH] = function ($params) { |
|
| 88 | + $this->functionDescriptionParsers[ODataConstants::STRFUN_LENGTH] = function($params) { |
|
| 89 | 89 | return "strlen($params[0])"; |
| 90 | 90 | }; |
| 91 | - $this->functionDescriptionParsers[ODataConstants::GUIDFUN_EQUAL] = function ($params) { |
|
| 91 | + $this->functionDescriptionParsers[ODataConstants::GUIDFUN_EQUAL] = function($params) { |
|
| 92 | 92 | return self::TYPE_NAMESPACE."Guid::guidEqual($params[0], $params[1])"; |
| 93 | 93 | }; |
| 94 | - $this->functionDescriptionParsers[ODataConstants::DATETIME_COMPARE] = function ($params) { |
|
| 94 | + $this->functionDescriptionParsers[ODataConstants::DATETIME_COMPARE] = function($params) { |
|
| 95 | 95 | return self::TYPE_NAMESPACE."DateTime::dateTimeCmp($params[0], $params[1])"; |
| 96 | 96 | }; |
| 97 | - $this->functionDescriptionParsers[ODataConstants::DATETIME_YEAR] = function ($params) { |
|
| 97 | + $this->functionDescriptionParsers[ODataConstants::DATETIME_YEAR] = function($params) { |
|
| 98 | 98 | return self::TYPE_NAMESPACE."DateTime::year($params[0])"; |
| 99 | 99 | }; |
| 100 | - $this->functionDescriptionParsers[ODataConstants::DATETIME_MONTH] = function ($params) { |
|
| 100 | + $this->functionDescriptionParsers[ODataConstants::DATETIME_MONTH] = function($params) { |
|
| 101 | 101 | return self::TYPE_NAMESPACE."DateTime::month($params[0])"; |
| 102 | 102 | }; |
| 103 | - $this->functionDescriptionParsers[ODataConstants::DATETIME_DAY] = function ($params) { |
|
| 103 | + $this->functionDescriptionParsers[ODataConstants::DATETIME_DAY] = function($params) { |
|
| 104 | 104 | return self::TYPE_NAMESPACE."DateTime::day($params[0])"; |
| 105 | 105 | }; |
| 106 | - $this->functionDescriptionParsers[ODataConstants::DATETIME_HOUR] = function ($params) { |
|
| 106 | + $this->functionDescriptionParsers[ODataConstants::DATETIME_HOUR] = function($params) { |
|
| 107 | 107 | return self::TYPE_NAMESPACE."DateTime::hour($params[0])"; |
| 108 | 108 | }; |
| 109 | - $this->functionDescriptionParsers[ODataConstants::DATETIME_MINUTE] = function ($params) { |
|
| 109 | + $this->functionDescriptionParsers[ODataConstants::DATETIME_MINUTE] = function($params) { |
|
| 110 | 110 | return self::TYPE_NAMESPACE."DateTime::minute($params[0])"; |
| 111 | 111 | }; |
| 112 | - $this->functionDescriptionParsers[ODataConstants::DATETIME_SECOND] = function ($params) { |
|
| 112 | + $this->functionDescriptionParsers[ODataConstants::DATETIME_SECOND] = function($params) { |
|
| 113 | 113 | return self::TYPE_NAMESPACE."DateTime::second($params[0])"; |
| 114 | 114 | }; |
| 115 | - $this->functionDescriptionParsers[ODataConstants::MATHFUN_ROUND] = function ($params) { |
|
| 115 | + $this->functionDescriptionParsers[ODataConstants::MATHFUN_ROUND] = function($params) { |
|
| 116 | 116 | return "round($params[0])"; |
| 117 | 117 | }; |
| 118 | - $this->functionDescriptionParsers[ODataConstants::MATHFUN_CEILING] = function ($params) { |
|
| 118 | + $this->functionDescriptionParsers[ODataConstants::MATHFUN_CEILING] = function($params) { |
|
| 119 | 119 | return "ceil($params[0])"; |
| 120 | 120 | }; |
| 121 | - $this->functionDescriptionParsers[ODataConstants::MATHFUN_FLOOR] = function ($params) { |
|
| 121 | + $this->functionDescriptionParsers[ODataConstants::MATHFUN_FLOOR] = function($params) { |
|
| 122 | 122 | return "floor($params[0])"; |
| 123 | 123 | }; |
| 124 | - $this->functionDescriptionParsers[ODataConstants::BINFUL_EQUAL] = function ($params) { |
|
| 124 | + $this->functionDescriptionParsers[ODataConstants::BINFUL_EQUAL] = function($params) { |
|
| 125 | 125 | return self::TYPE_NAMESPACE."Binary::binaryEqual($params[0], $params[1])"; |
| 126 | 126 | }; |
| 127 | - $this->functionDescriptionParsers['is_null'] = function ($params) { |
|
| 127 | + $this->functionDescriptionParsers['is_null'] = function($params) { |
|
| 128 | 128 | return "is_null($params[0])"; |
| 129 | 129 | }; |
| 130 | 130 | } |
@@ -67,7 +67,7 @@ |
||
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | /** |
| 70 | - * @return mixed |
|
| 70 | + * @return boolean |
|
| 71 | 71 | */ |
| 72 | 72 | protected function getIsDumping() |
| 73 | 73 | { |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | $date = Carbon::now(0); |
| 44 | 44 | $timeString = $date->toTimeString(); |
| 45 | 45 | $xTest = (null !== $xTest) ? $xTest |
| 46 | - : $request->method() . ";" . str_replace("/", "-", $request->path()) . ";" . $timeString . ";"; |
|
| 46 | + : $request->method().";".str_replace("/", "-", $request->path()).";".$timeString.";"; |
|
| 47 | 47 | if (null != $xTest) { |
| 48 | 48 | $reflectionClass = new \ReflectionClass('Illuminate\Http\Request'); |
| 49 | 49 | $reflectionProperty = $reflectionClass->getProperty('userResolver'); |
@@ -184,6 +184,7 @@ discard block |
||
| 184 | 184 | * @param mixed $orderBy sorted order if we want to get the data in some specific order |
| 185 | 185 | * @param int $top number of records which need to be skip |
| 186 | 186 | * @param String $skip value indicating what records to skip |
| 187 | + * @param SkipTokenInfo $skipToken |
|
| 187 | 188 | * |
| 188 | 189 | * @return QueryResult |
| 189 | 190 | * |
@@ -362,6 +363,7 @@ discard block |
||
| 362 | 363 | |
| 363 | 364 | /** |
| 364 | 365 | * @param $sourceEntityInstance |
| 366 | + * @param Model $checkInstance |
|
| 365 | 367 | * @throws ODataException |
| 366 | 368 | */ |
| 367 | 369 | private function checkAuth($sourceEntityInstance, $checkInstance = null) |
@@ -153,14 +153,14 @@ discard block |
||
| 153 | 153 | // loop thru, chunk by chunk, to reduce chances of exhausting memory |
| 154 | 154 | $sourceEntityInstance->chunk( |
| 155 | 155 | 5000, |
| 156 | - function ($results) use ($isvalid, &$skip, &$resultSet, &$rawCount, $rawTop) { |
|
| 156 | + function($results) use ($isvalid, &$skip, &$resultSet, &$rawCount, $rawTop) { |
|
| 157 | 157 | // apply filter |
| 158 | 158 | $results = $results->filter($isvalid); |
| 159 | 159 | // need to iterate through full result set to find count of items matching filter, |
| 160 | 160 | // so we can't bail out early |
| 161 | 161 | $rawCount += $results->count(); |
| 162 | 162 | // now bolt on filtrate to accumulating result set if we haven't accumulated enough bitz |
| 163 | - if ($rawTop > $resultSet->count() + $skip) { |
|
| 163 | + if ($rawTop > $resultSet->count()+$skip) { |
|
| 164 | 164 | $resultSet = collect(array_merge($resultSet->all(), $results->all())); |
| 165 | 165 | $sliceAmount = min($skip, $resultSet->count()); |
| 166 | 166 | $resultSet = $resultSet->slice($sliceAmount); |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | if (QueryType::COUNT() == $queryType || QueryType::ENTITIES_WITH_COUNT() == $queryType) { |
| 200 | 200 | $result->count = $resultCount; |
| 201 | 201 | } |
| 202 | - $hazMore = $bulkSetCount > $skip + count($resultSet); |
|
| 202 | + $hazMore = $bulkSetCount > $skip+count($resultSet); |
|
| 203 | 203 | $result->hasMore = $hazMore; |
| 204 | 204 | return $result; |
| 205 | 205 | } |
@@ -621,10 +621,10 @@ |
||
| 621 | 621 | { |
| 622 | 622 | $queryParameterString = null; |
| 623 | 623 | foreach ([ODataConstants::HTTPQUERY_STRING_FILTER, |
| 624 | - ODataConstants::HTTPQUERY_STRING_EXPAND, |
|
| 625 | - ODataConstants::HTTPQUERY_STRING_ORDERBY, |
|
| 626 | - ODataConstants::HTTPQUERY_STRING_INLINECOUNT, |
|
| 627 | - ODataConstants::HTTPQUERY_STRING_SELECT, ] as $queryOption) { |
|
| 624 | + ODataConstants::HTTPQUERY_STRING_EXPAND, |
|
| 625 | + ODataConstants::HTTPQUERY_STRING_ORDERBY, |
|
| 626 | + ODataConstants::HTTPQUERY_STRING_INLINECOUNT, |
|
| 627 | + ODataConstants::HTTPQUERY_STRING_SELECT, ] as $queryOption) { |
|
| 628 | 628 | $value = $this->getService()->getHost()->getQueryStringItem($queryOption); |
| 629 | 629 | if (!is_null($value)) { |
| 630 | 630 | if (!is_null($queryParameterString)) { |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | /** |
| 106 | 106 | * Write a top level entry resource. |
| 107 | 107 | * |
| 108 | - * @param mixed $entryObject Reference to the entry object to be written |
|
| 108 | + * @param QueryResult $entryObject Reference to the entry object to be written |
|
| 109 | 109 | * |
| 110 | 110 | * @return ODataEntry |
| 111 | 111 | */ |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | /** |
| 251 | 251 | * Write top level url element. |
| 252 | 252 | * |
| 253 | - * @param mixed $entryObject The entry resource whose url to be written |
|
| 253 | + * @param QueryResult $entryObject The entry resource whose url to be written |
|
| 254 | 254 | * |
| 255 | 255 | * @return ODataURL |
| 256 | 256 | */ |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | /** |
| 275 | 275 | * Write top level url collection. |
| 276 | 276 | * |
| 277 | - * @param array $entryObjects Array of entry resources |
|
| 277 | + * @param QueryResult $entryObjects Array of entry resources |
|
| 278 | 278 | * whose url to be written |
| 279 | 279 | * |
| 280 | 280 | * @return ODataURLCollection |
@@ -402,6 +402,9 @@ discard block |
||
| 402 | 402 | return $this->stack; |
| 403 | 403 | } |
| 404 | 404 | |
| 405 | + /** |
|
| 406 | + * @param string $containerName |
|
| 407 | + */ |
|
| 405 | 408 | protected function getEntryInstanceKey($entityInstance, ResourceType $resourceType, $containerName) |
| 406 | 409 | { |
| 407 | 410 | $typeName = $resourceType->getName(); |
@@ -433,7 +436,7 @@ discard block |
||
| 433 | 436 | /** |
| 434 | 437 | * @param $entryObject |
| 435 | 438 | * @param $type |
| 436 | - * @param $relativeUri |
|
| 439 | + * @param string $relativeUri |
|
| 437 | 440 | * @param $resourceType |
| 438 | 441 | * @return array |
| 439 | 442 | */ |
@@ -500,7 +503,7 @@ discard block |
||
| 500 | 503 | * Find a 'ExpandedProjectionNode' instance in the projection tree |
| 501 | 504 | * which describes the current segment. |
| 502 | 505 | * |
| 503 | - * @return ExpandedProjectionNode|null |
|
| 506 | + * @return null|\POData\UriProcessor\QueryProcessor\ExpandProjectionParser\RootProjectionNode|ExpandedProjectionNode |
|
| 504 | 507 | */ |
| 505 | 508 | protected function getCurrentExpandedProjectionNode() |
| 506 | 509 | { |
@@ -723,7 +726,7 @@ discard block |
||
| 723 | 726 | /** |
| 724 | 727 | * @param $entryObject |
| 725 | 728 | * @param $prop |
| 726 | - * @param $nuLink |
|
| 729 | + * @param ODataLink $nuLink |
|
| 727 | 730 | * @param $propKind |
| 728 | 731 | * @param $propName |
| 729 | 732 | */ |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | $this->service = $service; |
| 97 | 97 | $this->request = $request; |
| 98 | 98 | $this->absoluteServiceUri = $service->getHost()->getAbsoluteServiceUri()->getUrlAsString(); |
| 99 | - $this->absoluteServiceUriWithSlash = rtrim($this->absoluteServiceUri, '/') . '/'; |
|
| 99 | + $this->absoluteServiceUriWithSlash = rtrim($this->absoluteServiceUri, '/').'/'; |
|
| 100 | 100 | $this->stack = new SegmentStack($request); |
| 101 | 101 | $this->complexTypeInstanceCollection = []; |
| 102 | 102 | $this->modelSerialiser = new ModelSerialiser(); |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | $resourceType, |
| 143 | 143 | $resourceSet->getName() |
| 144 | 144 | ); |
| 145 | - $absoluteUri = rtrim($this->absoluteServiceUri, '/') . '/' . $relativeUri; |
|
| 145 | + $absoluteUri = rtrim($this->absoluteServiceUri, '/').'/'.$relativeUri; |
|
| 146 | 146 | |
| 147 | 147 | list($mediaLink, $mediaLinks) = $this->writeMediaData($entryObject->results, $type, $relativeUri, $resourceType); |
| 148 | 148 | |
@@ -163,8 +163,8 @@ discard block |
||
| 163 | 163 | $propType = 'application/atom+xml;type='.$propTail; |
| 164 | 164 | $propName = $prop->getName(); |
| 165 | 165 | $nuLink->title = $propName; |
| 166 | - $nuLink->name = ODataConstants::ODATA_RELATED_NAMESPACE . $propName; |
|
| 167 | - $nuLink->url = $relativeUri . '/' . $propName; |
|
| 166 | + $nuLink->name = ODataConstants::ODATA_RELATED_NAMESPACE.$propName; |
|
| 167 | + $nuLink->url = $relativeUri.'/'.$propName; |
|
| 168 | 168 | $nuLink->type = $propType; |
| 169 | 169 | |
| 170 | 170 | $navProp = new ODataNavigationPropertyInfo($prop, $this->shouldExpandSegment($propName)); |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | * |
| 201 | 201 | * @return ODataFeed |
| 202 | 202 | */ |
| 203 | - public function writeTopLevelElements(QueryResult &$entryObjects) |
|
| 203 | + public function writeTopLevelElements(QueryResult & $entryObjects) |
|
| 204 | 204 | { |
| 205 | 205 | assert(is_array($entryObjects->results), '!is_array($entryObjects->results)'); |
| 206 | 206 | |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | $segment = $this->getNextLinkUri($lastObject, $absoluteUri); |
| 241 | 241 | $nextLink = new ODataLink(); |
| 242 | 242 | $nextLink->name = ODataConstants::ATOM_LINK_NEXT_ATTRIBUTE_STRING; |
| 243 | - $nextLink->url = rtrim($this->absoluteServiceUri, '/') . '/' . $stackSegment . $segment; |
|
| 243 | + $nextLink->url = rtrim($this->absoluteServiceUri, '/').'/'.$stackSegment.$segment; |
|
| 244 | 244 | $odata->nextPageLink = $nextLink; |
| 245 | 245 | } |
| 246 | 246 | |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | $this->getCurrentResourceSetWrapper()->getName() |
| 266 | 266 | ); |
| 267 | 267 | |
| 268 | - $url->url = rtrim($this->absoluteServiceUri, '/') . '/' . $relativeUri; |
|
| 268 | + $url->url = rtrim($this->absoluteServiceUri, '/').'/'.$relativeUri; |
|
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | return $url; |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | $segment = $this->getNextLinkUri($lastObject, $this->getRequest()->getRequestUrl()->getUrlAsString()); |
| 296 | 296 | $nextLink = new ODataLink(); |
| 297 | 297 | $nextLink->name = ODataConstants::ATOM_LINK_NEXT_ATTRIBUTE_STRING; |
| 298 | - $nextLink->url = rtrim($this->absoluteServiceUri, '/') . '/' . $stackSegment . $segment; |
|
| 298 | + $nextLink->url = rtrim($this->absoluteServiceUri, '/').'/'.$stackSegment.$segment; |
|
| 299 | 299 | $urls->nextPageLink = $nextLink; |
| 300 | 300 | } |
| 301 | 301 | } |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | * @return ODataPropertyContent |
| 321 | 321 | * @codeCoverageIgnore |
| 322 | 322 | */ |
| 323 | - public function writeTopLevelComplexObject(QueryResult &$complexValue, $propertyName, ResourceType &$resourceType) |
|
| 323 | + public function writeTopLevelComplexObject(QueryResult & $complexValue, $propertyName, ResourceType & $resourceType) |
|
| 324 | 324 | { |
| 325 | 325 | // TODO: Figure out if we need to bother implementing this |
| 326 | 326 | } |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | * @codeCoverageIgnore |
| 338 | 338 | * @return ODataPropertyContent |
| 339 | 339 | */ |
| 340 | - public function writeTopLevelBagObject(QueryResult &$BagValue, $propertyName, ResourceType &$resourceType) |
|
| 340 | + public function writeTopLevelBagObject(QueryResult & $BagValue, $propertyName, ResourceType & $resourceType) |
|
| 341 | 341 | { |
| 342 | 342 | // TODO: Figure out if we need to bother implementing this |
| 343 | 343 | } |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | * @codeCoverageIgnore |
| 355 | 355 | * @return ODataPropertyContent |
| 356 | 356 | */ |
| 357 | - public function writeTopLevelPrimitive(QueryResult &$primitiveValue, ResourceProperty &$resourceProperty = null) |
|
| 357 | + public function writeTopLevelPrimitive(QueryResult & $primitiveValue, ResourceProperty & $resourceProperty = null) |
|
| 358 | 358 | { |
| 359 | 359 | // TODO: Figure out if we need to bother implementing this |
| 360 | 360 | } |
@@ -407,7 +407,7 @@ discard block |
||
| 407 | 407 | $typeName = $resourceType->getName(); |
| 408 | 408 | $keyProperties = $resourceType->getKeyProperties(); |
| 409 | 409 | assert(count($keyProperties) != 0, 'count($keyProperties) == 0'); |
| 410 | - $keyString = $containerName . '('; |
|
| 410 | + $keyString = $containerName.'('; |
|
| 411 | 411 | $comma = null; |
| 412 | 412 | foreach ($keyProperties as $keyName => $resourceProperty) { |
| 413 | 413 | $keyType = $resourceProperty->getInstanceType(); |
@@ -421,7 +421,7 @@ discard block |
||
| 421 | 421 | } |
| 422 | 422 | |
| 423 | 423 | $keyValue = $keyType->convertToOData($keyValue); |
| 424 | - $keyString .= $comma . $keyName . '=' . $keyValue; |
|
| 424 | + $keyString .= $comma.$keyName.'='.$keyValue; |
|
| 425 | 425 | $comma = ','; |
| 426 | 426 | } |
| 427 | 427 | |
@@ -446,7 +446,7 @@ discard block |
||
| 446 | 446 | $mediaLink = null; |
| 447 | 447 | if ($resourceType->isMediaLinkEntry()) { |
| 448 | 448 | $eTag = $streamProviderWrapper->getStreamETag2($entryObject, null, $context); |
| 449 | - $mediaLink = new ODataMediaLink($type, '/$value', $relativeUri . '/$value', '*/*', $eTag); |
|
| 449 | + $mediaLink = new ODataMediaLink($type, '/$value', $relativeUri.'/$value', '*/*', $eTag); |
|
| 450 | 450 | } |
| 451 | 451 | $mediaLinks = []; |
| 452 | 452 | if ($resourceType->hasNamedStream()) { |
@@ -587,7 +587,7 @@ discard block |
||
| 587 | 587 | $segmentWrappers = $this->getStack()->getSegmentWrappers(); |
| 588 | 588 | $count = count($segmentWrappers); |
| 589 | 589 | |
| 590 | - return 0 == $count ? $this->getRequest()->getTargetResourceSetWrapper() : $segmentWrappers[$count - 1]; |
|
| 590 | + return 0 == $count ? $this->getRequest()->getTargetResourceSetWrapper() : $segmentWrappers[$count-1]; |
|
| 591 | 591 | } |
| 592 | 592 | |
| 593 | 593 | /** |
@@ -637,21 +637,21 @@ discard block |
||
| 637 | 637 | $value = $this->getService()->getHost()->getQueryStringItem($queryOption); |
| 638 | 638 | if (!is_null($value)) { |
| 639 | 639 | if (!is_null($queryParameterString)) { |
| 640 | - $queryParameterString = $queryParameterString . '&'; |
|
| 640 | + $queryParameterString = $queryParameterString.'&'; |
|
| 641 | 641 | } |
| 642 | 642 | |
| 643 | - $queryParameterString .= $queryOption . '=' . $value; |
|
| 643 | + $queryParameterString .= $queryOption.'='.$value; |
|
| 644 | 644 | } |
| 645 | 645 | } |
| 646 | 646 | |
| 647 | 647 | $topCountValue = $this->getRequest()->getTopOptionCount(); |
| 648 | 648 | if (!is_null($topCountValue)) { |
| 649 | - $remainingCount = $topCountValue - $this->getRequest()->getTopCount(); |
|
| 649 | + $remainingCount = $topCountValue-$this->getRequest()->getTopCount(); |
|
| 650 | 650 | if (!is_null($queryParameterString)) { |
| 651 | 651 | $queryParameterString .= '&'; |
| 652 | 652 | } |
| 653 | 653 | |
| 654 | - $queryParameterString .= ODataConstants::HTTPQUERY_STRING_TOP . '=' . $remainingCount; |
|
| 654 | + $queryParameterString .= ODataConstants::HTTPQUERY_STRING_TOP.'='.$remainingCount; |
|
| 655 | 655 | } |
| 656 | 656 | |
| 657 | 657 | if (!is_null($queryParameterString)) { |
@@ -679,7 +679,7 @@ discard block |
||
| 679 | 679 | * |
| 680 | 680 | * @return string |
| 681 | 681 | */ |
| 682 | - private function primitiveToString(IType &$type, $primitiveValue) |
|
| 682 | + private function primitiveToString(IType & $type, $primitiveValue) |
|
| 683 | 683 | { |
| 684 | 684 | if ($type instanceof Boolean) { |
| 685 | 685 | $stringValue = (true === $primitiveValue) ? 'true' : 'false'; |
@@ -751,7 +751,7 @@ discard block |
||
| 751 | 751 | $nuLink->expandedResult->selfLink->title = $propName; |
| 752 | 752 | $nuLink->expandedResult->selfLink->url = $nuLink->url; |
| 753 | 753 | $nuLink->expandedResult->title = $propName; |
| 754 | - $nuLink->expandedResult->id = rtrim($this->absoluteServiceUri, '/') . '/' . $nuLink->url; |
|
| 754 | + $nuLink->expandedResult->id = rtrim($this->absoluteServiceUri, '/').'/'.$nuLink->url; |
|
| 755 | 755 | } |
| 756 | 756 | } |
| 757 | 757 | } |
@@ -765,6 +765,6 @@ discard block |
||
| 765 | 765 | { |
| 766 | 766 | $this->service = $service; |
| 767 | 767 | $this->absoluteServiceUri = $service->getHost()->getAbsoluteServiceUri()->getUrlAsString(); |
| 768 | - $this->absoluteServiceUriWithSlash = rtrim($this->absoluteServiceUri, '/') . '/'; |
|
| 768 | + $this->absoluteServiceUriWithSlash = rtrim($this->absoluteServiceUri, '/').'/'; |
|
| 769 | 769 | } |
| 770 | 770 | } |