@@ -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 | } |
@@ -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)) { |
@@ -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); |
@@ -346,6 +346,7 @@ |
||
| 346 | 346 | |
| 347 | 347 | /** |
| 348 | 348 | * @param $sourceEntityInstance |
| 349 | + * @param Model $checkInstance |
|
| 349 | 350 | * @throws ODataException |
| 350 | 351 | */ |
| 351 | 352 | private function checkAuth($sourceEntityInstance, $checkInstance = null) |
@@ -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( |
@@ -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 | |
@@ -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 | } |