@@ -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 | } |
@@ -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)) { |
@@ -301,7 +301,7 @@ |
||
301 | 301 | if (!isset($functionDescription)) { |
302 | 302 | throw new \InvalidArgumentException('onFunctionCallExpression'); |
303 | 303 | } |
304 | - if(!array_key_exists ($functionDescription->name, $this->functionDescriptionParsers)){ |
|
304 | + if (!array_key_exists($functionDescription->name, $this->functionDescriptionParsers)) { |
|
305 | 305 | throw new \InvalidArgumentException('onFunctionCallExpression'); |
306 | 306 | } |
307 | 307 | return $this->functionDescriptionParsers[$functionDescription->name]($params); |
@@ -96,14 +96,14 @@ |
||
96 | 96 | // loop thru, chunk by chunk, to reduce chances of exhausting memory |
97 | 97 | $sourceEntityInstance->chunk( |
98 | 98 | 5000, |
99 | - function ($results) use ($isvalid, &$skipToken, &$resultSet, &$rawCount, $rawTop) { |
|
99 | + function($results) use ($isvalid, &$skipToken, &$resultSet, &$rawCount, $rawTop) { |
|
100 | 100 | // apply filter |
101 | 101 | $results = $results->filter($isvalid); |
102 | 102 | // need to iterate through full result set to find count of items matching filter, |
103 | 103 | // so we can't bail out early |
104 | 104 | $rawCount += $results->count(); |
105 | 105 | // now bolt on filtrate to accumulating result set if we haven't accumulated enough bitz |
106 | - if ($rawTop > $resultSet->count() + $skipToken) { |
|
106 | + if ($rawTop > $resultSet->count()+$skipToken) { |
|
107 | 107 | $resultSet = collect(array_merge($resultSet->all(), $results->all())); |
108 | 108 | $sliceAmount = min($skipToken, $resultSet->count()); |
109 | 109 | $resultSet = $resultSet->slice($sliceAmount); |
@@ -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 | { |
@@ -513,10 +513,10 @@ discard block |
||
513 | 513 | |
514 | 514 | $keyRaw = $isBelong ? $foo->$fkMethodName() : $foo->$fkMethodAlternate(); |
515 | 515 | $keySegments = explode('.', $keyRaw); |
516 | - $keyName = $keySegments[count($keySegments) - 1]; |
|
516 | + $keyName = $keySegments[count($keySegments)-1]; |
|
517 | 517 | $localRaw = $isBelong ? $foo->$rkMethodName() : $foo->$rkMethodAlternate(); |
518 | 518 | $localSegments = explode('.', $localRaw); |
519 | - $localName = $localSegments[count($localSegments) - 1]; |
|
519 | + $localName = $localSegments[count($localSegments)-1]; |
|
520 | 520 | $first = $keyName; |
521 | 521 | $last = $localName; |
522 | 522 | $this->addRelationsHook($hooks, $first, $property, $last, $mult, $targ); |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | $keyName = $isBelong ? $foo->$fkMethodName() : $foo->$fkMethodAlternate(); |
544 | 544 | $localRaw = $isBelong ? $foo->$rkMethodName() : $foo->$rkMethodAlternate(); |
545 | 545 | $localSegments = explode('.', $localRaw); |
546 | - $localName = $localSegments[count($localSegments) - 1]; |
|
546 | + $localName = $localSegments[count($localSegments)-1]; |
|
547 | 547 | $first = $isBelong ? $localName : $keyName; |
548 | 548 | $last = $isBelong ? $keyName : $localName; |
549 | 549 | $this->addRelationsHook($hooks, $first, $property, $last, $mult, $targ); |
@@ -567,10 +567,10 @@ discard block |
||
567 | 567 | |
568 | 568 | $keyRaw = $isMany ? $foo->$fkMethodName() : $foo->$fkMethodAlternate(); |
569 | 569 | $keySegments = explode('.', $keyRaw); |
570 | - $keyName = $keySegments[count($keySegments) - 1]; |
|
570 | + $keyName = $keySegments[count($keySegments)-1]; |
|
571 | 571 | $localRaw = $isMany ? $foo->$rkMethodName() : $foo->$rkMethodAlternate(); |
572 | 572 | $localSegments = explode('.', $localRaw); |
573 | - $localName = $localSegments[count($localSegments) - 1]; |
|
573 | + $localName = $localSegments[count($localSegments)-1]; |
|
574 | 574 | $first = $isMany ? $keyName : $localName; |
575 | 575 | $last = $isMany ? $localName : $keyName; |
576 | 576 | $this->addRelationsHook($hooks, $first, $property, $last, $mult, $targ); |
@@ -593,10 +593,10 @@ discard block |
||
593 | 593 | |
594 | 594 | $keyRaw = $isMany ? $foo->$fkMethodName() : $foo->$fkMethodAlternate(); |
595 | 595 | $keySegments = explode('.', $keyRaw); |
596 | - $keyName = $keySegments[count($keySegments) - 1]; |
|
596 | + $keyName = $keySegments[count($keySegments)-1]; |
|
597 | 597 | $localRaw = $isMany ? $foo->$rkMethodName() : $foo->$rkMethodAlternate(); |
598 | 598 | $localSegments = explode('.', $localRaw); |
599 | - $localName = $localSegments[count($localSegments) - 1]; |
|
599 | + $localName = $localSegments[count($localSegments)-1]; |
|
600 | 600 | |
601 | 601 | $first = $keyName; |
602 | 602 | $last = $localName; |
@@ -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 |
@@ -21,12 +21,12 @@ |
||
21 | 21 | { |
22 | 22 | Route::any( |
23 | 23 | 'odata.svc/{section}', |
24 | - [ 'uses' => 'AlgoWeb\PODataLaravel\Controllers\ODataController@index', 'middleware' => 'auth.basic'] |
|
24 | + ['uses' => 'AlgoWeb\PODataLaravel\Controllers\ODataController@index', 'middleware' => 'auth.basic'] |
|
25 | 25 | ) |
26 | 26 | ->where(['section' => '.*']); |
27 | 27 | Route::any( |
28 | 28 | 'odata.svc', |
29 | - [ 'uses' => 'AlgoWeb\PODataLaravel\Controllers\ODataController@index', 'middleware' => 'auth.basic'] |
|
29 | + ['uses' => 'AlgoWeb\PODataLaravel\Controllers\ODataController@index', 'middleware' => 'auth.basic'] |
|
30 | 30 | ); |
31 | 31 | } |
32 | 32 |