@@ -119,13 +119,13 @@ discard block |
||
119 | 119 | public function setFields(array $fields) |
120 | 120 | { |
121 | 121 | if (0 == count($fields)) { |
122 | - $msg = 'Fields array must not be empty for '.$this->getClassName(); |
|
122 | + $msg = 'Fields array must not be empty for ' . $this->getClassName(); |
|
123 | 123 | throw new \Exception($msg); |
124 | 124 | } |
125 | 125 | $keys = []; |
126 | 126 | foreach ($fields as $propName => $field) { |
127 | 127 | if (!$field instanceof EntityField) { |
128 | - $msg = 'Fields array must only have EntityField objects for '.$this->getClassName(); |
|
128 | + $msg = 'Fields array must only have EntityField objects for ' . $this->getClassName(); |
|
129 | 129 | throw new \Exception($msg); |
130 | 130 | } |
131 | 131 | if ($field->getIsKeyField()) { |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | } |
134 | 134 | } |
135 | 135 | if (0 == count($keys)) { |
136 | - $msg = 'No key field supplied in fields array for '.$this->getClassName(); |
|
136 | + $msg = 'No key field supplied in fields array for ' . $this->getClassName(); |
|
137 | 137 | throw new \Exception($msg); |
138 | 138 | } |
139 | 139 | $this->fields = $fields; |
@@ -635,7 +635,7 @@ discard block |
||
635 | 635 | public function retrieveCasts() |
636 | 636 | { |
637 | 637 | $exists = method_exists($this, 'getCasts'); |
638 | - return $exists ? (array)$this->getCasts() : (array)$this->casts; |
|
638 | + return $exists ? (array) $this->getCasts() : (array) $this->casts; |
|
639 | 639 | } |
640 | 640 | |
641 | 641 | /** |
@@ -782,7 +782,7 @@ discard block |
||
782 | 782 | $builder = $connect->getSchemaBuilder(); |
783 | 783 | $columns = $builder->getColumnListing($table); |
784 | 784 | |
785 | - self::$tableColumns = (array)$columns; |
|
785 | + self::$tableColumns = (array) $columns; |
|
786 | 786 | } |
787 | 787 | return self::$tableColumns; |
788 | 788 | } |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | { |
136 | 136 | /** @var SimpleMetadataProvider $meta */ |
137 | 137 | $meta = App::make('metadata'); |
138 | - $namespace = $meta->getContainerNamespace().'.'; |
|
138 | + $namespace = $meta->getContainerNamespace() . '.'; |
|
139 | 139 | |
140 | 140 | $entities = $objectModel->getEntities(); |
141 | 141 | foreach ($entities as $entity) { |
@@ -150,13 +150,13 @@ discard block |
||
150 | 150 | $entity->setOdataResourceType($entityType); |
151 | 151 | $this->implementProperties($entity); |
152 | 152 | $meta->addResourceSet($pluralName, $entityType); |
153 | - $meta->oDataEntityMap[$className] = $meta->oDataEntityMap[$namespace.$entityName]; |
|
153 | + $meta->oDataEntityMap[$className] = $meta->oDataEntityMap[$namespace . $entityName]; |
|
154 | 154 | } |
155 | 155 | $metaCount = count($meta->oDataEntityMap); |
156 | 156 | $entityCount = count($entities); |
157 | 157 | $expected = 2 * $entityCount; |
158 | 158 | if ($metaCount != $expected) { |
159 | - $msg = 'Expected ' . $expected . ' items, actually got '.$metaCount; |
|
159 | + $msg = 'Expected ' . $expected . ' items, actually got ' . $metaCount; |
|
160 | 160 | throw new InvalidOperationException($msg); |
161 | 161 | } |
162 | 162 |
@@ -36,7 +36,7 @@ |
||
36 | 36 | $values = $skipToken->getOrderByKeysInToken(); |
37 | 37 | $numValues = count($values); |
38 | 38 | if ($numValues != count($segments)) { |
39 | - $msg = 'Expected '.count($segments).', got '.$numValues; |
|
39 | + $msg = 'Expected ' . count($segments) . ', got ' . $numValues; |
|
40 | 40 | throw new InvalidOperationException($msg); |
41 | 41 | } |
42 | 42 |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | // so we can't bail out early |
387 | 387 | $rawCount += $results->count(); |
388 | 388 | // now bolt on filtrate to accumulating result set if we haven't accumulated enough bitz |
389 | - if ($rawTop > $resultSet->count() + $skip) { |
|
389 | + if ($rawTop > $resultSet->count()+$skip) { |
|
390 | 390 | $resultSet = collect(array_merge($resultSet->all(), $results->all())); |
391 | 391 | $sliceAmount = min($skip, $resultSet->count()); |
392 | 392 | $resultSet = $resultSet->slice($sliceAmount); |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | if (QueryType::COUNT() == $qVal || QueryType::ENTITIES_WITH_COUNT() == $qVal) { |
462 | 462 | $result->count = $resultCount; |
463 | 463 | } |
464 | - $hazMore = $bulkSetCount > $skip + count($resultSet); |
|
464 | + $hazMore = $bulkSetCount > $skip+count($resultSet); |
|
465 | 465 | $result->hasMore = $hazMore; |
466 | 466 | } |
467 | 467 | } |
@@ -186,8 +186,8 @@ |
||
186 | 186 | */ |
187 | 187 | protected function updateLightStack(int $newCount) |
188 | 188 | { |
189 | - $this->lightStack[$newCount - 1]['count']--; |
|
190 | - if (0 == $this->lightStack[$newCount - 1]['count']) { |
|
189 | + $this->lightStack[$newCount-1]['count']--; |
|
190 | + if (0 == $this->lightStack[$newCount-1]['count']) { |
|
191 | 191 | array_pop($this->lightStack); |
192 | 192 | } |
193 | 193 | } |
@@ -63,7 +63,7 @@ |
||
63 | 63 | { |
64 | 64 | $class = __CLASS__; |
65 | 65 | if (!isset($classMap[$class])) { |
66 | - throw new \Exception(sprintf('%s was not found in autoload class map, this usually indicates you '. |
|
66 | + throw new \Exception(sprintf('%s was not found in autoload class map, this usually indicates you ' . |
|
67 | 67 | 'need to dump an optimised autoloader (`composer dump-autoload -o`)', $class)); |
68 | 68 | } |
69 | 69 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | { |
23 | 23 | switch (true) { |
24 | 24 | case $rel instanceof BelongsTo: |
25 | - $key = $rel->{$this->checkMethodNameList($rel, ['getForeignKeyName', 'getForeignKey'])}(); |
|
25 | + $key = $rel->{$this->checkMethodNameList($rel, ['getForeignKeyName', 'getForeignKey'])}(); |
|
26 | 26 | break; |
27 | 27 | case $rel instanceof BelongsToMany: |
28 | 28 | $key = $rel->getForeignPivotKeyName(); |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | $key = $rel->getForeignKeyName(); |
32 | 32 | break; |
33 | 33 | case $rel instanceof HasManyThrough: |
34 | - $key = $rel->getQualifiedFarKeyName(); |
|
34 | + $key = $rel->getQualifiedFarKeyName(); |
|
35 | 35 | break; |
36 | 36 | default: |
37 | 37 | $msg = sprintf('Unknown Relationship Type %s', get_class($rel)); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $stub->setBaseType(get_class(self::getParent($relation))); |
70 | 70 | $stub->setRelationName($name); |
71 | 71 | $stub->setThroughFieldChain($keyChain); |
72 | - $stub->setKeyField($keyChain[0] ?: $relation->getRelated()->getKeyName() ); |
|
72 | + $stub->setKeyField($keyChain[0] ?: $relation->getRelated()->getKeyName()); |
|
73 | 73 | $stub->setForeignField($keyChain[0]); |
74 | 74 | $stub->setMultiplicity(AssociationStubRelationType::ONE()); |
75 | 75 | $stub->setTargType(null); |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | * @return AssociationStubBase |
103 | 103 | */ |
104 | 104 | protected static function handleHasManyThrough(string $name, Relation $relation, $cacheKey = 'HasManyThrough'):AssociationStubBase{ |
105 | - $farParentGetter = function(){ |
|
105 | + $farParentGetter = function () { |
|
106 | 106 | return $this->farParent; |
107 | 107 | }; |
108 | 108 | $farParent = call_user_func($farParentGetter->bindTo($relation, HasManyThrough::class)); |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * @return AssociationStubBase |
127 | 127 | */ |
128 | 128 | protected static function handleMorphToMany(string $name, Relation $relation, $cacheKey = 'BelongsToMany'): AssociationStubBase{ |
129 | - $inverseGetter = function(){ |
|
129 | + $inverseGetter = function () { |
|
130 | 130 | return $this->inverse; |
131 | 131 | }; |
132 | 132 | $inverse = call_user_func($inverseGetter->bindTo($relation, MorphToMany::class)); |
@@ -214,8 +214,8 @@ discard block |
||
214 | 214 | return $stub; |
215 | 215 | } |
216 | 216 | |
217 | - private static function getParent(Relation $relation){ |
|
218 | - $getter = function(){ |
|
217 | + private static function getParent(Relation $relation) { |
|
218 | + $getter = function () { |
|
219 | 219 | return $this->parent; |
220 | 220 | }; |
221 | 221 | return call_user_func($getter->bindTo($relation, Relation::class)); |
@@ -223,11 +223,11 @@ discard block |
||
223 | 223 | |
224 | 224 | private static function getKeyChain(Relation $relation, string $cacheKey) : array { |
225 | 225 | $fields = self::$fieldOrderCache[$cacheKey]; |
226 | - $getter = function() use ($fields){ |
|
226 | + $getter = function () use ($fields){ |
|
227 | 227 | $carry = []; |
228 | - foreach($fields as $item){ |
|
228 | + foreach ($fields as $item) { |
|
229 | 229 | $v = $this->{$item}; |
230 | - if($v == null && $item == 'ownerKey'){ |
|
230 | + if ($v == null && $item == 'ownerKey') { |
|
231 | 231 | $carry[] = null; |
232 | 232 | continue; |
233 | 233 | } |
@@ -242,8 +242,8 @@ discard block |
||
242 | 242 | |
243 | 243 | private static $fieldOrderCache = [ |
244 | 244 | 'BelongsTo' => ['ownerKey', 'foreignKey'], |
245 | - 'BelongsToMany' => ['parentKey','foreignPivotKey','relatedPivotKey','relatedKey'], |
|
246 | - 'HasOneOrMany' => ['localKey', 'foreignKey' ], |
|
245 | + 'BelongsToMany' => ['parentKey', 'foreignPivotKey', 'relatedPivotKey', 'relatedKey'], |
|
246 | + 'HasOneOrMany' => ['localKey', 'foreignKey'], |
|
247 | 247 | 'HasManyThrough' => ['localKey', 'firstKey', 'secondLocalKey', 'secondKey'], |
248 | 248 | |
249 | 249 | ]; |