@@ -54,7 +54,7 @@ |
||
54 | 54 | }; |
55 | 55 | $this->functionDescriptionParsers[ODataConstants::STRFUN_ENDSWITH] = function ($params) { |
56 | 56 | return '(strcmp(substr(' . $params[0] . ', strlen(' . $params[0] . ') - strlen(' . $params[1] . ')), ' |
57 | - .$params[1] . ') === 0)'; |
|
57 | + .$params[1] . ') === 0)'; |
|
58 | 58 | }; |
59 | 59 | $this->functionDescriptionParsers[ODataConstants::STRFUN_INDEXOF] = function ($params) { |
60 | 60 | return 'strpos(' . $params[0] . ', ' . $params[1] . ')'; |
@@ -789,10 +789,10 @@ |
||
789 | 789 | { |
790 | 790 | $queryParameterString = null; |
791 | 791 | foreach ([ODataConstants::HTTPQUERY_STRING_FILTER, |
792 | - ODataConstants::HTTPQUERY_STRING_EXPAND, |
|
793 | - ODataConstants::HTTPQUERY_STRING_ORDERBY, |
|
794 | - ODataConstants::HTTPQUERY_STRING_INLINECOUNT, |
|
795 | - ODataConstants::HTTPQUERY_STRING_SELECT, ] as $queryOption) { |
|
792 | + ODataConstants::HTTPQUERY_STRING_EXPAND, |
|
793 | + ODataConstants::HTTPQUERY_STRING_ORDERBY, |
|
794 | + ODataConstants::HTTPQUERY_STRING_INLINECOUNT, |
|
795 | + ODataConstants::HTTPQUERY_STRING_SELECT, ] as $queryOption) { |
|
796 | 796 | $value = $this->getService()->getHost()->getQueryStringItem($queryOption); |
797 | 797 | if (null !== $value) { |
798 | 798 | if (null !== $queryParameterString) { |
@@ -227,17 +227,17 @@ |
||
227 | 227 | $lastCode = $code[strlen($code)-1]; |
228 | 228 | assert('}' == $lastCode, 'Final character of function definition must be closing brace'); |
229 | 229 | foreach ([ |
230 | - 'hasMany', |
|
231 | - 'hasManyThrough', |
|
232 | - 'belongsToMany', |
|
233 | - 'hasOne', |
|
234 | - 'belongsTo', |
|
235 | - 'morphOne', |
|
236 | - 'morphTo', |
|
237 | - 'morphMany', |
|
238 | - 'morphToMany', |
|
239 | - 'morphedByMany' |
|
240 | - ] as $relation) { |
|
230 | + 'hasMany', |
|
231 | + 'hasManyThrough', |
|
232 | + 'belongsToMany', |
|
233 | + 'hasOne', |
|
234 | + 'belongsTo', |
|
235 | + 'morphOne', |
|
236 | + 'morphTo', |
|
237 | + 'morphMany', |
|
238 | + 'morphToMany', |
|
239 | + 'morphedByMany' |
|
240 | + ] as $relation) { |
|
241 | 241 | $search = '$this->' . $relation . '('; |
242 | 242 | if ($pos = stripos($code, $search)) { |
243 | 243 | //Resolve the relation's model to a Relation object. |
@@ -131,10 +131,10 @@ |
||
131 | 131 | if (0 == count($lastCandidates)) { |
132 | 132 | continue; |
133 | 133 | } |
134 | - foreach($lastCandidates as $lc){ |
|
134 | + foreach ($lastCandidates as $lc) { |
|
135 | 135 | $stub = clone $this->knownSides[$knownType][$key]; |
136 | 136 | $isMulti = ($stub->getMultiplicity()->getValue() == \AlgoWeb\PODataLaravel\Models\ObjectMap\Entities\Associations\AssociationStubRelationType::MANY); |
137 | - $RelPolyTypeName = str_plural(substr($lc->getBaseType(),strrpos($lc->getBaseType(),"\\")+1),$isMulti?2:1); |
|
137 | + $RelPolyTypeName = str_plural(substr($lc->getBaseType(), strrpos($lc->getBaseType(), "\\")+1), $isMulti ? 2 : 1); |
|
138 | 138 | $stub->setRelationName($stub->getRelationName() . "_" . $RelPolyTypeName); |
139 | 139 | $assoc = new AssociationMonomorphic(); |
140 | 140 | $first = -1 === $stub->compare($lc); |
@@ -131,7 +131,7 @@ |
||
131 | 131 | if (0 == count($lastCandidates)) { |
132 | 132 | continue; |
133 | 133 | } |
134 | - foreach($lastCandidates as $lc){ |
|
134 | + foreach($lastCandidates as $lc) { |
|
135 | 135 | $stub = clone $this->knownSides[$knownType][$key]; |
136 | 136 | $isMulti = ($stub->getMultiplicity()->getValue() == \AlgoWeb\PODataLaravel\Models\ObjectMap\Entities\Associations\AssociationStubRelationType::MANY); |
137 | 137 | $RelPolyTypeName = str_plural(substr($lc->getBaseType(),strrpos($lc->getBaseType(),"\\")+1),$isMulti?2:1); |
@@ -194,7 +194,7 @@ |
||
194 | 194 | { |
195 | 195 | if ($association instanceof AssociationMonomorphic) { |
196 | 196 | $stub = $isFirst ? $association->getFirst() : $association->getLast(); |
197 | - if (null === $stub || (!in_array($stub, $this->stubs) && !($stub instanceof AssociationStubPolymorphic) )) { |
|
197 | + if (null === $stub || (!in_array($stub, $this->stubs) && !($stub instanceof AssociationStubPolymorphic))) { |
|
198 | 198 | throw new \InvalidArgumentException('Association cannot be connected to this entity'); |
199 | 199 | } |
200 | 200 | $propertyName = $stub->getRelationName(); |
@@ -137,7 +137,7 @@ |
||
137 | 137 | $metaCount = count($meta->oDataEntityMap); |
138 | 138 | $entityCount = count($entities); |
139 | 139 | $expected = 2 * $entityCount; |
140 | - assert($metaCount == $expected, 'Expected ' . $expected . ' items, actually got '.$metaCount); |
|
140 | + assert($metaCount == $expected, 'Expected ' . $expected . ' items, actually got ' . $metaCount); |
|
141 | 141 | |
142 | 142 | if (null === $objectModel->getAssociations()) { |
143 | 143 | return; |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | return null; |
374 | 374 | } |
375 | 375 | assert($result instanceof Model, get_class($result)); |
376 | - if($targetProperty->getResourceType()->getInstanceType()->getName() != get_class($result)){ |
|
376 | + if ($targetProperty->getResourceType()->getInstanceType()->getName() != get_class($result)) { |
|
377 | 377 | return null; |
378 | 378 | } |
379 | 379 | return $result; |
@@ -485,22 +485,22 @@ discard block |
||
485 | 485 | $rawLoad = []; |
486 | 486 | foreach ($load as $line) { |
487 | 487 | assert(is_string($line), 'Eager-load elements must be non-empty strings'); |
488 | - $lineParts = explode("/",$line); |
|
488 | + $lineParts = explode("/", $line); |
|
489 | 489 | $numberOfParts = count($lineParts); |
490 | - for($i = 0; $i<$numberOfParts;$i++){ |
|
490 | + for ($i = 0; $i < $numberOfParts; $i++) { |
|
491 | 491 | $lineParts[$i] = $this->getLaravelRelationName($lineParts[$i]); |
492 | 492 | } |
493 | - $remixLine = implode(".",$lineParts); |
|
493 | + $remixLine = implode(".", $lineParts); |
|
494 | 494 | $rawLoad[] = $remixLine; |
495 | 495 | } |
496 | 496 | return $rawLoad; |
497 | 497 | } |
498 | 498 | |
499 | - private function getLaravelRelationName($odataProperty){ |
|
499 | + private function getLaravelRelationName($odataProperty) { |
|
500 | 500 | $laravelProperty = $odataProperty; |
501 | 501 | $pos = strrpos($laravelProperty, "_"); |
502 | - if($pos !== false){ |
|
503 | - $laravelProperty = substr($laravelProperty,0,$pos); |
|
502 | + if ($pos !== false) { |
|
503 | + $laravelProperty = substr($laravelProperty, 0, $pos); |
|
504 | 504 | } |
505 | 505 | return $laravelProperty; |
506 | 506 | } |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | return null; |
374 | 374 | } |
375 | 375 | assert($result instanceof Model, get_class($result)); |
376 | - if($targetProperty->getResourceType()->getInstanceType()->getName() != get_class($result)){ |
|
376 | + if($targetProperty->getResourceType()->getInstanceType()->getName() != get_class($result)) { |
|
377 | 377 | return null; |
378 | 378 | } |
379 | 379 | return $result; |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | assert(is_string($line), 'Eager-load elements must be non-empty strings'); |
488 | 488 | $lineParts = explode("/",$line); |
489 | 489 | $numberOfParts = count($lineParts); |
490 | - for($i = 0; $i<$numberOfParts;$i++){ |
|
490 | + for($i = 0; $i<$numberOfParts;$i++) { |
|
491 | 491 | $lineParts[$i] = $this->getLaravelRelationName($lineParts[$i]); |
492 | 492 | } |
493 | 493 | $remixLine = implode(".",$lineParts); |
@@ -496,10 +496,11 @@ discard block |
||
496 | 496 | return $rawLoad; |
497 | 497 | } |
498 | 498 | |
499 | - private function getLaravelRelationName($odataProperty){ |
|
499 | + private function getLaravelRelationName($odataProperty) |
|
500 | + { |
|
500 | 501 | $laravelProperty = $odataProperty; |
501 | 502 | $pos = strrpos($laravelProperty, "_"); |
502 | - if($pos !== false){ |
|
503 | + if($pos !== false) { |
|
503 | 504 | $laravelProperty = substr($laravelProperty,0,$pos); |
504 | 505 | } |
505 | 506 | return $laravelProperty; |