@@ -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) |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | foreach ($parameters as $name => $line) { |
| 114 | 114 | $processed[$name] = ['direction' => $line['direction'], 'value' => $line['value']]; |
| 115 | 115 | $sourceEntityInstance = $sourceEntityInstance |
| 116 | - ->orWhere(function ($query) use ($processed) { |
|
| 116 | + ->orWhere(function($query) use ($processed) { |
|
| 117 | 117 | foreach ($processed as $key => $proc) { |
| 118 | 118 | $query->where($key, $proc['direction'], $proc['value']); |
| 119 | 119 | } |
@@ -156,14 +156,14 @@ discard block |
||
| 156 | 156 | // loop thru, chunk by chunk, to reduce chances of exhausting memory |
| 157 | 157 | $sourceEntityInstance->chunk( |
| 158 | 158 | 5000, |
| 159 | - function ($results) use ($isvalid, &$skip, &$resultSet, &$rawCount, $rawTop) { |
|
| 159 | + function($results) use ($isvalid, &$skip, &$resultSet, &$rawCount, $rawTop) { |
|
| 160 | 160 | // apply filter |
| 161 | 161 | $results = $results->filter($isvalid); |
| 162 | 162 | // need to iterate through full result set to find count of items matching filter, |
| 163 | 163 | // so we can't bail out early |
| 164 | 164 | $rawCount += $results->count(); |
| 165 | 165 | // now bolt on filtrate to accumulating result set if we haven't accumulated enough bitz |
| 166 | - if ($rawTop > $resultSet->count() + $skip) { |
|
| 166 | + if ($rawTop > $resultSet->count()+$skip) { |
|
| 167 | 167 | $resultSet = collect(array_merge($resultSet->all(), $results->all())); |
| 168 | 168 | $sliceAmount = min($skip, $resultSet->count()); |
| 169 | 169 | $resultSet = $resultSet->slice($sliceAmount); |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | if (QueryType::COUNT() == $queryType || QueryType::ENTITIES_WITH_COUNT() == $queryType) { |
| 202 | 202 | $result->count = $resultCount; |
| 203 | 203 | } |
| 204 | - $hazMore = $bulkSetCount > $skip + count($resultSet); |
|
| 204 | + $hazMore = $bulkSetCount > $skip+count($resultSet); |
|
| 205 | 205 | $result->hasMore = $hazMore; |
| 206 | 206 | return $result; |
| 207 | 207 | } |
@@ -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)) { |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | /** |
| 108 | 108 | * Write a top level entry resource. |
| 109 | 109 | * |
| 110 | - * @param mixed $entryObject Reference to the entry object to be written |
|
| 110 | + * @param QueryResult $entryObject Reference to the entry object to be written |
|
| 111 | 111 | * |
| 112 | 112 | * @return ODataEntry |
| 113 | 113 | */ |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | /** |
| 258 | 258 | * Write top level url element. |
| 259 | 259 | * |
| 260 | - * @param mixed $entryObject The entry resource whose url to be written |
|
| 260 | + * @param QueryResult $entryObject The entry resource whose url to be written |
|
| 261 | 261 | * |
| 262 | 262 | * @return ODataURL |
| 263 | 263 | */ |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | /** |
| 282 | 282 | * Write top level url collection. |
| 283 | 283 | * |
| 284 | - * @param array $entryObjects Array of entry resources |
|
| 284 | + * @param QueryResult $entryObjects Array of entry resources |
|
| 285 | 285 | * whose url to be written |
| 286 | 286 | * |
| 287 | 287 | * @return ODataURLCollection |
@@ -441,6 +441,9 @@ discard block |
||
| 441 | 441 | return $this->stack; |
| 442 | 442 | } |
| 443 | 443 | |
| 444 | + /** |
|
| 445 | + * @param string $containerName |
|
| 446 | + */ |
|
| 444 | 447 | protected function getEntryInstanceKey($entityInstance, ResourceType $resourceType, $containerName) |
| 445 | 448 | { |
| 446 | 449 | $typeName = $resourceType->getName(); |
@@ -472,7 +475,7 @@ discard block |
||
| 472 | 475 | /** |
| 473 | 476 | * @param $entryObject |
| 474 | 477 | * @param $type |
| 475 | - * @param $relativeUri |
|
| 478 | + * @param string $relativeUri |
|
| 476 | 479 | * @param $resourceType |
| 477 | 480 | * @return array |
| 478 | 481 | */ |
@@ -539,7 +542,7 @@ discard block |
||
| 539 | 542 | * Find a 'ExpandedProjectionNode' instance in the projection tree |
| 540 | 543 | * which describes the current segment. |
| 541 | 544 | * |
| 542 | - * @return ExpandedProjectionNode|null |
|
| 545 | + * @return null|\POData\UriProcessor\QueryProcessor\ExpandProjectionParser\RootProjectionNode|ExpandedProjectionNode |
|
| 543 | 546 | */ |
| 544 | 547 | protected function getCurrentExpandedProjectionNode() |
| 545 | 548 | { |
@@ -764,7 +767,7 @@ discard block |
||
| 764 | 767 | /** |
| 765 | 768 | * @param $entryObject |
| 766 | 769 | * @param $prop |
| 767 | - * @param $nuLink |
|
| 770 | + * @param ODataLink $nuLink |
|
| 768 | 771 | * @param $propKind |
| 769 | 772 | * @param $propName |
| 770 | 773 | */ |
@@ -875,6 +878,9 @@ discard block |
||
| 875 | 878 | return $internalContent; |
| 876 | 879 | } |
| 877 | 880 | |
| 881 | + /** |
|
| 882 | + * @param ResourcePropertyKind $resourceKind |
|
| 883 | + */ |
|
| 878 | 884 | public static function isMatchPrimitive($resourceKind) |
| 879 | 885 | { |
| 880 | 886 | if (16 > $resourceKind) { |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | $this->service = $service; |
| 100 | 100 | $this->request = $request; |
| 101 | 101 | $this->absoluteServiceUri = $service->getHost()->getAbsoluteServiceUri()->getUrlAsString(); |
| 102 | - $this->absoluteServiceUriWithSlash = rtrim($this->absoluteServiceUri, '/') . '/'; |
|
| 102 | + $this->absoluteServiceUriWithSlash = rtrim($this->absoluteServiceUri, '/').'/'; |
|
| 103 | 103 | $this->stack = new SegmentStack($request); |
| 104 | 104 | $this->complexTypeInstanceCollection = []; |
| 105 | 105 | $this->modelSerialiser = new ModelSerialiser(); |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | $resourceType, |
| 146 | 146 | $resourceSet->getName() |
| 147 | 147 | ); |
| 148 | - $absoluteUri = rtrim($this->absoluteServiceUri, '/') . '/' . $relativeUri; |
|
| 148 | + $absoluteUri = rtrim($this->absoluteServiceUri, '/').'/'.$relativeUri; |
|
| 149 | 149 | |
| 150 | 150 | list($mediaLink, $mediaLinks) = $this->writeMediaData($entryObject->results, $type, $relativeUri, $resourceType); |
| 151 | 151 | |
@@ -166,8 +166,8 @@ discard block |
||
| 166 | 166 | $propType = 'application/atom+xml;type='.$propTail; |
| 167 | 167 | $propName = $prop->getName(); |
| 168 | 168 | $nuLink->title = $propName; |
| 169 | - $nuLink->name = ODataConstants::ODATA_RELATED_NAMESPACE . $propName; |
|
| 170 | - $nuLink->url = $relativeUri . '/' . $propName; |
|
| 169 | + $nuLink->name = ODataConstants::ODATA_RELATED_NAMESPACE.$propName; |
|
| 170 | + $nuLink->url = $relativeUri.'/'.$propName; |
|
| 171 | 171 | $nuLink->type = $propType; |
| 172 | 172 | |
| 173 | 173 | $navProp = new ODataNavigationPropertyInfo($prop, $this->shouldExpandSegment($propName)); |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | * |
| 204 | 204 | * @return ODataFeed |
| 205 | 205 | */ |
| 206 | - public function writeTopLevelElements(QueryResult &$entryObjects) |
|
| 206 | + public function writeTopLevelElements(QueryResult & $entryObjects) |
|
| 207 | 207 | { |
| 208 | 208 | assert(is_array($entryObjects->results), '!is_array($entryObjects->results)'); |
| 209 | 209 | |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | $resourceSet = $this->getRequest()->getTargetResourceSetWrapper()->getResourceSet(); |
| 241 | 241 | $requestTop = $this->getRequest()->getTopOptionCount(); |
| 242 | 242 | $pageSize = $this->getService()->getConfiguration()->getEntitySetPageSize($resourceSet); |
| 243 | - $requestTop = (null == $requestTop) ? $pageSize + 1 : $requestTop; |
|
| 243 | + $requestTop = (null == $requestTop) ? $pageSize+1 : $requestTop; |
|
| 244 | 244 | |
| 245 | 245 | if (true === $entryObjects->hasMore && $requestTop > $pageSize) { |
| 246 | 246 | $stackSegment = $setName; |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | $segment = $this->getNextLinkUri($lastObject, $absoluteUri); |
| 249 | 249 | $nextLink = new ODataLink(); |
| 250 | 250 | $nextLink->name = ODataConstants::ATOM_LINK_NEXT_ATTRIBUTE_STRING; |
| 251 | - $nextLink->url = rtrim($this->absoluteServiceUri, '/') . '/' . $stackSegment . $segment; |
|
| 251 | + $nextLink->url = rtrim($this->absoluteServiceUri, '/').'/'.$stackSegment.$segment; |
|
| 252 | 252 | $odata->nextPageLink = $nextLink; |
| 253 | 253 | } |
| 254 | 254 | |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | $this->getCurrentResourceSetWrapper()->getName() |
| 274 | 274 | ); |
| 275 | 275 | |
| 276 | - $url->url = rtrim($this->absoluteServiceUri, '/') . '/' . $relativeUri; |
|
| 276 | + $url->url = rtrim($this->absoluteServiceUri, '/').'/'.$relativeUri; |
|
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | return $url; |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | $segment = $this->getNextLinkUri($lastObject, $this->getRequest()->getRequestUrl()->getUrlAsString()); |
| 304 | 304 | $nextLink = new ODataLink(); |
| 305 | 305 | $nextLink->name = ODataConstants::ATOM_LINK_NEXT_ATTRIBUTE_STRING; |
| 306 | - $nextLink->url = rtrim($this->absoluteServiceUri, '/') . '/' . $stackSegment . $segment; |
|
| 306 | + $nextLink->url = rtrim($this->absoluteServiceUri, '/').'/'.$stackSegment.$segment; |
|
| 307 | 307 | $urls->nextPageLink = $nextLink; |
| 308 | 308 | } |
| 309 | 309 | } |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | * |
| 328 | 328 | * @return ODataPropertyContent |
| 329 | 329 | */ |
| 330 | - public function writeTopLevelComplexObject(QueryResult &$complexValue, $propertyName, ResourceType &$resourceType) |
|
| 330 | + public function writeTopLevelComplexObject(QueryResult & $complexValue, $propertyName, ResourceType & $resourceType) |
|
| 331 | 331 | { |
| 332 | 332 | $result = $complexValue->results; |
| 333 | 333 | |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | * bag object |
| 357 | 357 | * @return ODataPropertyContent |
| 358 | 358 | */ |
| 359 | - public function writeTopLevelBagObject(QueryResult &$BagValue, $propertyName, ResourceType &$resourceType) |
|
| 359 | + public function writeTopLevelBagObject(QueryResult & $BagValue, $propertyName, ResourceType & $resourceType) |
|
| 360 | 360 | { |
| 361 | 361 | $result = $BagValue->results; |
| 362 | 362 | |
@@ -379,7 +379,7 @@ discard block |
||
| 379 | 379 | * primitive property to be written |
| 380 | 380 | * @return ODataPropertyContent |
| 381 | 381 | */ |
| 382 | - public function writeTopLevelPrimitive(QueryResult &$primitiveValue, ResourceProperty &$resourceProperty = null) |
|
| 382 | + public function writeTopLevelPrimitive(QueryResult & $primitiveValue, ResourceProperty & $resourceProperty = null) |
|
| 383 | 383 | { |
| 384 | 384 | assert(null != $resourceProperty, "Resource property must not be null"); |
| 385 | 385 | $propertyContent = new ODataPropertyContent(); |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | $typeName = $resourceType->getName(); |
| 448 | 448 | $keyProperties = $resourceType->getKeyProperties(); |
| 449 | 449 | assert(count($keyProperties) != 0, 'count($keyProperties) == 0'); |
| 450 | - $keyString = $containerName . '('; |
|
| 450 | + $keyString = $containerName.'('; |
|
| 451 | 451 | $comma = null; |
| 452 | 452 | foreach ($keyProperties as $keyName => $resourceProperty) { |
| 453 | 453 | $keyType = $resourceProperty->getInstanceType(); |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | } |
| 462 | 462 | |
| 463 | 463 | $keyValue = $keyType->convertToOData($keyValue); |
| 464 | - $keyString .= $comma . $keyName . '=' . $keyValue; |
|
| 464 | + $keyString .= $comma.$keyName.'='.$keyValue; |
|
| 465 | 465 | $comma = ','; |
| 466 | 466 | } |
| 467 | 467 | |
@@ -486,7 +486,7 @@ discard block |
||
| 486 | 486 | $mediaLink = null; |
| 487 | 487 | if ($resourceType->isMediaLinkEntry()) { |
| 488 | 488 | $eTag = $streamProviderWrapper->getStreamETag2($entryObject, null, $context); |
| 489 | - $mediaLink = new ODataMediaLink($type, '/$value', $relativeUri . '/$value', '*/*', $eTag); |
|
| 489 | + $mediaLink = new ODataMediaLink($type, '/$value', $relativeUri.'/$value', '*/*', $eTag); |
|
| 490 | 490 | } |
| 491 | 491 | $mediaLinks = []; |
| 492 | 492 | if ($resourceType->hasNamedStream()) { |
@@ -627,7 +627,7 @@ discard block |
||
| 627 | 627 | $segmentWrappers = $this->getStack()->getSegmentWrappers(); |
| 628 | 628 | $count = count($segmentWrappers); |
| 629 | 629 | |
| 630 | - return 0 == $count ? $this->getRequest()->getTargetResourceSetWrapper() : $segmentWrappers[$count - 1]; |
|
| 630 | + return 0 == $count ? $this->getRequest()->getTargetResourceSetWrapper() : $segmentWrappers[$count-1]; |
|
| 631 | 631 | } |
| 632 | 632 | |
| 633 | 633 | /** |
@@ -677,22 +677,22 @@ discard block |
||
| 677 | 677 | $value = $this->getService()->getHost()->getQueryStringItem($queryOption); |
| 678 | 678 | if (!is_null($value)) { |
| 679 | 679 | if (!is_null($queryParameterString)) { |
| 680 | - $queryParameterString = $queryParameterString . '&'; |
|
| 680 | + $queryParameterString = $queryParameterString.'&'; |
|
| 681 | 681 | } |
| 682 | 682 | |
| 683 | - $queryParameterString .= $queryOption . '=' . $value; |
|
| 683 | + $queryParameterString .= $queryOption.'='.$value; |
|
| 684 | 684 | } |
| 685 | 685 | } |
| 686 | 686 | |
| 687 | 687 | $topCountValue = $this->getRequest()->getTopOptionCount(); |
| 688 | 688 | if (!is_null($topCountValue)) { |
| 689 | - $remainingCount = $topCountValue - $this->getRequest()->getTopCount(); |
|
| 689 | + $remainingCount = $topCountValue-$this->getRequest()->getTopCount(); |
|
| 690 | 690 | if (0 < $remainingCount) { |
| 691 | 691 | if (!is_null($queryParameterString)) { |
| 692 | 692 | $queryParameterString .= '&'; |
| 693 | 693 | } |
| 694 | 694 | |
| 695 | - $queryParameterString .= ODataConstants::HTTPQUERY_STRING_TOP . '=' . $remainingCount; |
|
| 695 | + $queryParameterString .= ODataConstants::HTTPQUERY_STRING_TOP.'='.$remainingCount; |
|
| 696 | 696 | } |
| 697 | 697 | } |
| 698 | 698 | |
@@ -721,7 +721,7 @@ discard block |
||
| 721 | 721 | * |
| 722 | 722 | * @return string |
| 723 | 723 | */ |
| 724 | - private function primitiveToString(IType &$type, $primitiveValue) |
|
| 724 | + private function primitiveToString(IType & $type, $primitiveValue) |
|
| 725 | 725 | { |
| 726 | 726 | if ($type instanceof Boolean) { |
| 727 | 727 | $stringValue = (true === $primitiveValue) ? 'true' : 'false'; |
@@ -793,7 +793,7 @@ discard block |
||
| 793 | 793 | $nuLink->expandedResult->selfLink->title = $propName; |
| 794 | 794 | $nuLink->expandedResult->selfLink->url = $nuLink->url; |
| 795 | 795 | $nuLink->expandedResult->title = $propName; |
| 796 | - $nuLink->expandedResult->id = rtrim($this->absoluteServiceUri, '/') . '/' . $nuLink->url; |
|
| 796 | + $nuLink->expandedResult->id = rtrim($this->absoluteServiceUri, '/').'/'.$nuLink->url; |
|
| 797 | 797 | } |
| 798 | 798 | } |
| 799 | 799 | } |
@@ -807,7 +807,7 @@ discard block |
||
| 807 | 807 | { |
| 808 | 808 | $this->service = $service; |
| 809 | 809 | $this->absoluteServiceUri = $service->getHost()->getAbsoluteServiceUri()->getUrlAsString(); |
| 810 | - $this->absoluteServiceUriWithSlash = rtrim($this->absoluteServiceUri, '/') . '/'; |
|
| 810 | + $this->absoluteServiceUriWithSlash = rtrim($this->absoluteServiceUri, '/').'/'; |
|
| 811 | 811 | } |
| 812 | 812 | |
| 813 | 813 | /** |
@@ -815,7 +815,7 @@ discard block |
||
| 815 | 815 | * @param $result |
| 816 | 816 | * @return ODataBagContent |
| 817 | 817 | */ |
| 818 | - protected function writeBagValue(ResourceType &$resourceType, $result) |
|
| 818 | + protected function writeBagValue(ResourceType & $resourceType, $result) |
|
| 819 | 819 | { |
| 820 | 820 | assert(null == $result || is_array($result), 'Bag parameter must be null or array'); |
| 821 | 821 | $typeKind = $resourceType->getResourceTypeKind(); |
@@ -847,7 +847,7 @@ discard block |
||
| 847 | 847 | * @param string $propertyName |
| 848 | 848 | * @return ODataPropertyContent |
| 849 | 849 | */ |
| 850 | - protected function writeComplexValue(ResourceType &$resourceType, &$result, $propertyName = null) |
|
| 850 | + protected function writeComplexValue(ResourceType & $resourceType, &$result, $propertyName = null) |
|
| 851 | 851 | { |
| 852 | 852 | assert(is_object($result), 'Supplied $customObject must be an object'); |
| 853 | 853 | |