@@ -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)) { |
@@ -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 | */ |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | $this->service = $service; |
98 | 98 | $this->request = $request; |
99 | 99 | $this->absoluteServiceUri = $service->getHost()->getAbsoluteServiceUri()->getUrlAsString(); |
100 | - $this->absoluteServiceUriWithSlash = rtrim($this->absoluteServiceUri, '/') . '/'; |
|
100 | + $this->absoluteServiceUriWithSlash = rtrim($this->absoluteServiceUri, '/').'/'; |
|
101 | 101 | $this->stack = new SegmentStack($request); |
102 | 102 | $this->complexTypeInstanceCollection = []; |
103 | 103 | $this->modelSerialiser = new ModelSerialiser(); |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | $resourceType, |
144 | 144 | $resourceSet->getName() |
145 | 145 | ); |
146 | - $absoluteUri = rtrim($this->absoluteServiceUri, '/') . '/' . $relativeUri; |
|
146 | + $absoluteUri = rtrim($this->absoluteServiceUri, '/').'/'.$relativeUri; |
|
147 | 147 | |
148 | 148 | list($mediaLink, $mediaLinks) = $this->writeMediaData($entryObject->results, $type, $relativeUri, $resourceType); |
149 | 149 | |
@@ -164,8 +164,8 @@ discard block |
||
164 | 164 | $propType = 'application/atom+xml;type='.$propTail; |
165 | 165 | $propName = $prop->getName(); |
166 | 166 | $nuLink->title = $propName; |
167 | - $nuLink->name = ODataConstants::ODATA_RELATED_NAMESPACE . $propName; |
|
168 | - $nuLink->url = $relativeUri . '/' . $propName; |
|
167 | + $nuLink->name = ODataConstants::ODATA_RELATED_NAMESPACE.$propName; |
|
168 | + $nuLink->url = $relativeUri.'/'.$propName; |
|
169 | 169 | $nuLink->type = $propType; |
170 | 170 | |
171 | 171 | $navProp = new ODataNavigationPropertyInfo($prop, $this->shouldExpandSegment($propName)); |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | * |
202 | 202 | * @return ODataFeed |
203 | 203 | */ |
204 | - public function writeTopLevelElements(QueryResult &$entryObjects) |
|
204 | + public function writeTopLevelElements(QueryResult & $entryObjects) |
|
205 | 205 | { |
206 | 206 | assert(is_array($entryObjects->results), '!is_array($entryObjects->results)'); |
207 | 207 | |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | $resourceSet = $this->getRequest()->getTargetResourceSetWrapper()->getResourceSet(); |
239 | 239 | $requestTop = $this->getRequest()->getTopOptionCount(); |
240 | 240 | $pageSize = $this->getService()->getConfiguration()->getEntitySetPageSize($resourceSet); |
241 | - $requestTop = (null == $requestTop) ? $pageSize + 1 : $requestTop; |
|
241 | + $requestTop = (null == $requestTop) ? $pageSize+1 : $requestTop; |
|
242 | 242 | |
243 | 243 | if (true === $entryObjects->hasMore && $requestTop > $pageSize) { |
244 | 244 | $stackSegment = $setName; |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | $segment = $this->getNextLinkUri($lastObject, $absoluteUri); |
247 | 247 | $nextLink = new ODataLink(); |
248 | 248 | $nextLink->name = ODataConstants::ATOM_LINK_NEXT_ATTRIBUTE_STRING; |
249 | - $nextLink->url = rtrim($this->absoluteServiceUri, '/') . '/' . $stackSegment . $segment; |
|
249 | + $nextLink->url = rtrim($this->absoluteServiceUri, '/').'/'.$stackSegment.$segment; |
|
250 | 250 | $odata->nextPageLink = $nextLink; |
251 | 251 | } |
252 | 252 | |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | $this->getCurrentResourceSetWrapper()->getName() |
272 | 272 | ); |
273 | 273 | |
274 | - $url->url = rtrim($this->absoluteServiceUri, '/') . '/' . $relativeUri; |
|
274 | + $url->url = rtrim($this->absoluteServiceUri, '/').'/'.$relativeUri; |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | return $url; |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | $segment = $this->getNextLinkUri($lastObject, $this->getRequest()->getRequestUrl()->getUrlAsString()); |
302 | 302 | $nextLink = new ODataLink(); |
303 | 303 | $nextLink->name = ODataConstants::ATOM_LINK_NEXT_ATTRIBUTE_STRING; |
304 | - $nextLink->url = rtrim($this->absoluteServiceUri, '/') . '/' . $stackSegment . $segment; |
|
304 | + $nextLink->url = rtrim($this->absoluteServiceUri, '/').'/'.$stackSegment.$segment; |
|
305 | 305 | $urls->nextPageLink = $nextLink; |
306 | 306 | } |
307 | 307 | } |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | * |
326 | 326 | * @return ODataPropertyContent |
327 | 327 | */ |
328 | - public function writeTopLevelComplexObject(QueryResult &$complexValue, $propertyName, ResourceType &$resourceType) |
|
328 | + public function writeTopLevelComplexObject(QueryResult & $complexValue, $propertyName, ResourceType & $resourceType) |
|
329 | 329 | { |
330 | 330 | $result = $complexValue->results; |
331 | 331 | |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | * bag object |
370 | 370 | * @return ODataPropertyContent |
371 | 371 | */ |
372 | - public function writeTopLevelBagObject(QueryResult &$BagValue, $propertyName, ResourceType &$resourceType) |
|
372 | + public function writeTopLevelBagObject(QueryResult & $BagValue, $propertyName, ResourceType & $resourceType) |
|
373 | 373 | { |
374 | 374 | $result = $BagValue->results; |
375 | 375 | |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | * to be written |
404 | 404 | * @return ODataPropertyContent |
405 | 405 | */ |
406 | - public function writeTopLevelPrimitive(QueryResult &$primitiveValue, ResourceProperty &$resourceProperty = null) |
|
406 | + public function writeTopLevelPrimitive(QueryResult & $primitiveValue, ResourceProperty & $resourceProperty = null) |
|
407 | 407 | { |
408 | 408 | assert(null != $resourceProperty, "Resource property must not be null"); |
409 | 409 | $propertyContent = new ODataPropertyContent(); |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | $typeName = $resourceType->getName(); |
472 | 472 | $keyProperties = $resourceType->getKeyProperties(); |
473 | 473 | assert(count($keyProperties) != 0, 'count($keyProperties) == 0'); |
474 | - $keyString = $containerName . '('; |
|
474 | + $keyString = $containerName.'('; |
|
475 | 475 | $comma = null; |
476 | 476 | foreach ($keyProperties as $keyName => $resourceProperty) { |
477 | 477 | $keyType = $resourceProperty->getInstanceType(); |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | } |
486 | 486 | |
487 | 487 | $keyValue = $keyType->convertToOData($keyValue); |
488 | - $keyString .= $comma . $keyName . '=' . $keyValue; |
|
488 | + $keyString .= $comma.$keyName.'='.$keyValue; |
|
489 | 489 | $comma = ','; |
490 | 490 | } |
491 | 491 | |
@@ -510,7 +510,7 @@ discard block |
||
510 | 510 | $mediaLink = null; |
511 | 511 | if ($resourceType->isMediaLinkEntry()) { |
512 | 512 | $eTag = $streamProviderWrapper->getStreamETag2($entryObject, null, $context); |
513 | - $mediaLink = new ODataMediaLink($type, '/$value', $relativeUri . '/$value', '*/*', $eTag); |
|
513 | + $mediaLink = new ODataMediaLink($type, '/$value', $relativeUri.'/$value', '*/*', $eTag); |
|
514 | 514 | } |
515 | 515 | $mediaLinks = []; |
516 | 516 | if ($resourceType->hasNamedStream()) { |
@@ -651,7 +651,7 @@ discard block |
||
651 | 651 | $segmentWrappers = $this->getStack()->getSegmentWrappers(); |
652 | 652 | $count = count($segmentWrappers); |
653 | 653 | |
654 | - return 0 == $count ? $this->getRequest()->getTargetResourceSetWrapper() : $segmentWrappers[$count - 1]; |
|
654 | + return 0 == $count ? $this->getRequest()->getTargetResourceSetWrapper() : $segmentWrappers[$count-1]; |
|
655 | 655 | } |
656 | 656 | |
657 | 657 | /** |
@@ -701,22 +701,22 @@ discard block |
||
701 | 701 | $value = $this->getService()->getHost()->getQueryStringItem($queryOption); |
702 | 702 | if (!is_null($value)) { |
703 | 703 | if (!is_null($queryParameterString)) { |
704 | - $queryParameterString = $queryParameterString . '&'; |
|
704 | + $queryParameterString = $queryParameterString.'&'; |
|
705 | 705 | } |
706 | 706 | |
707 | - $queryParameterString .= $queryOption . '=' . $value; |
|
707 | + $queryParameterString .= $queryOption.'='.$value; |
|
708 | 708 | } |
709 | 709 | } |
710 | 710 | |
711 | 711 | $topCountValue = $this->getRequest()->getTopOptionCount(); |
712 | 712 | if (!is_null($topCountValue)) { |
713 | - $remainingCount = $topCountValue - $this->getRequest()->getTopCount(); |
|
713 | + $remainingCount = $topCountValue-$this->getRequest()->getTopCount(); |
|
714 | 714 | if (0 < $remainingCount) { |
715 | 715 | if (!is_null($queryParameterString)) { |
716 | 716 | $queryParameterString .= '&'; |
717 | 717 | } |
718 | 718 | |
719 | - $queryParameterString .= ODataConstants::HTTPQUERY_STRING_TOP . '=' . $remainingCount; |
|
719 | + $queryParameterString .= ODataConstants::HTTPQUERY_STRING_TOP.'='.$remainingCount; |
|
720 | 720 | } |
721 | 721 | } |
722 | 722 | |
@@ -745,7 +745,7 @@ discard block |
||
745 | 745 | * |
746 | 746 | * @return string |
747 | 747 | */ |
748 | - private function primitiveToString(IType &$type, $primitiveValue) |
|
748 | + private function primitiveToString(IType & $type, $primitiveValue) |
|
749 | 749 | { |
750 | 750 | if ($type instanceof Boolean) { |
751 | 751 | $stringValue = (true === $primitiveValue) ? 'true' : 'false'; |
@@ -817,7 +817,7 @@ discard block |
||
817 | 817 | $nuLink->expandedResult->selfLink->title = $propName; |
818 | 818 | $nuLink->expandedResult->selfLink->url = $nuLink->url; |
819 | 819 | $nuLink->expandedResult->title = $propName; |
820 | - $nuLink->expandedResult->id = rtrim($this->absoluteServiceUri, '/') . '/' . $nuLink->url; |
|
820 | + $nuLink->expandedResult->id = rtrim($this->absoluteServiceUri, '/').'/'.$nuLink->url; |
|
821 | 821 | } |
822 | 822 | } |
823 | 823 | } |
@@ -831,6 +831,6 @@ discard block |
||
831 | 831 | { |
832 | 832 | $this->service = $service; |
833 | 833 | $this->absoluteServiceUri = $service->getHost()->getAbsoluteServiceUri()->getUrlAsString(); |
834 | - $this->absoluteServiceUriWithSlash = rtrim($this->absoluteServiceUri, '/') . '/'; |
|
834 | + $this->absoluteServiceUriWithSlash = rtrim($this->absoluteServiceUri, '/').'/'; |
|
835 | 835 | } |
836 | 836 | } |