@@ -163,7 +163,7 @@ |
||
| 163 | 163 | { |
| 164 | 164 | $foreign = $this->foreignKey; |
| 165 | 165 | |
| 166 | - return BaseCollection::make($this->dictionary[$type])->map(function ($entities) use ($foreign) { |
|
| 166 | + return BaseCollection::make($this->dictionary[$type])->map(function($entities) use ($foreign) { |
|
| 167 | 167 | return head($entities)->{$foreign}; |
| 168 | 168 | |
| 169 | 169 | })->unique(); |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | $key = $this->getEntityKey($key); |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - return array_first($this->items, function ($entity, $itemKey) use ($key) { |
|
| 48 | + return array_first($this->items, function($entity, $itemKey) use ($key) { |
|
| 49 | 49 | return $this->getEntityKey($entity) == $key; |
| 50 | 50 | }, $default); |
| 51 | 51 | } |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | */ |
| 165 | 165 | public function getEntityHashes() |
| 166 | 166 | { |
| 167 | - return array_map(function ($entity) { |
|
| 167 | + return array_map(function($entity) { |
|
| 168 | 168 | $class = get_class($entity); |
| 169 | 169 | |
| 170 | 170 | $mapper = Manager::getMapper($class); |
@@ -357,7 +357,7 @@ discard block |
||
| 357 | 357 | */ |
| 358 | 358 | public function max($key = null) |
| 359 | 359 | { |
| 360 | - return $this->reduce(function ($result, $item) use ($key) { |
|
| 360 | + return $this->reduce(function($result, $item) use ($key) { |
|
| 361 | 361 | $wrapper = $this->factory->make($item); |
| 362 | 362 | |
| 363 | 363 | return (is_null($result) || $wrapper->getEntityAttribute($key) > $result) ? |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | */ |
| 377 | 377 | public function min($key = null) |
| 378 | 378 | { |
| 379 | - return $this->reduce(function ($result, $item) use ($key) { |
|
| 379 | + return $this->reduce(function($result, $item) use ($key) { |
|
| 380 | 380 | $wrapper = $this->factory->make($item); |
| 381 | 381 | |
| 382 | 382 | return (is_null($result) || $wrapper->getEntityAttribute($key) < $result) |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | public function build(array $results, array $eagerLoads) |
| 58 | 58 | { |
| 59 | 59 | // First, we'll cast every single result to array |
| 60 | - $results = array_map(function ($item) { |
|
| 60 | + $results = array_map(function($item) { |
|
| 61 | 61 | return (array) $item; |
| 62 | 62 | }, $results); |
| 63 | 63 | |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | // constraints have been specified for the eager load and we'll just put |
| 114 | 114 | // an empty Closure with the loader so that we can treat all the same. |
| 115 | 115 | if (is_numeric($name)) { |
| 116 | - $f = function () { |
|
| 116 | + $f = function() { |
|
| 117 | 117 | }; |
| 118 | 118 | |
| 119 | 119 | list($name, $constraints) = [$constraints, $f]; |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | $progress[] = $segment; |
| 150 | 150 | |
| 151 | 151 | if (!isset($results[$last = implode('.', $progress)])) { |
| 152 | - $results[$last] = function () { |
|
| 152 | + $results[$last] = function() { |
|
| 153 | 153 | }; |
| 154 | 154 | } |
| 155 | 155 | } |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | // We want to run a relationship query without any constrains so that we will |
| 223 | 223 | // not have to remove these where clauses manually which gets really hacky |
| 224 | 224 | // and is error prone while we remove the developer's own where clauses. |
| 225 | - $query = Relationship::noConstraints(function () use ($relation) { |
|
| 225 | + $query = Relationship::noConstraints(function() use ($relation) { |
|
| 226 | 226 | return $this->entityMap->$relation($this->defaultMapper->newInstance()); |
| 227 | 227 | }); |
| 228 | 228 | |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | { |
| 289 | 289 | $builder = new EntityBuilder($this->defaultMapper, array_keys($this->eagerLoads)); |
| 290 | 290 | |
| 291 | - return collect($results)->map(function ($item, $key) use ($builder) { |
|
| 291 | + return collect($results)->map(function($item, $key) use ($builder) { |
|
| 292 | 292 | return $builder->build($item); |
| 293 | 293 | })->all(); |
| 294 | 294 | } |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | */ |
| 303 | 303 | protected function buildUsingSingleTableInheritance(array $results) |
| 304 | 304 | { |
| 305 | - return collect($results)->map(function ($item, $key) { |
|
| 305 | + return collect($results)->map(function($item, $key) { |
|
| 306 | 306 | $builder = $this->builderForResult($item); |
| 307 | 307 | |
| 308 | 308 | return $builder->build($item); |
@@ -372,7 +372,7 @@ |
||
| 372 | 372 | */ |
| 373 | 373 | public function getGlobalScope($scope) |
| 374 | 374 | { |
| 375 | - return array_first($this->globalScopes, function ($key, $value) use ($scope) { |
|
| 375 | + return array_first($this->globalScopes, function($key, $value) use ($scope) { |
|
| 376 | 376 | return $scope instanceof $value; |
| 377 | 377 | }); |
| 378 | 378 | } |
@@ -514,7 +514,7 @@ |
||
| 514 | 514 | */ |
| 515 | 515 | protected function getHasRelationQuery($relation, $entity) |
| 516 | 516 | { |
| 517 | - return Relationship::noConstraints(function () use ($relation, $entity) { |
|
| 517 | + return Relationship::noConstraints(function() use ($relation, $entity) { |
|
| 518 | 518 | return $this->entityMap->$relation($entity); |
| 519 | 519 | }); |
| 520 | 520 | } |
@@ -946,7 +946,7 @@ |
||
| 946 | 946 | */ |
| 947 | 947 | protected function getEntityHashesFromRelation($relation) |
| 948 | 948 | { |
| 949 | - return array_map(function ($aggregate) { |
|
| 949 | + return array_map(function($aggregate) { |
|
| 950 | 950 | return $aggregate->getEntityHash(); |
| 951 | 951 | }, $this->relationships[$relation]); |
| 952 | 952 | } |
@@ -46,7 +46,7 @@ |
||
| 46 | 46 | { |
| 47 | 47 | $factory = new LazyLoadingValueHolderFactory(); |
| 48 | 48 | |
| 49 | - $initializer = function (&$wrappedObject, LazyLoadingInterface $proxy, $method, array $parameters, &$initializer) use ($entity, $relation) { |
|
| 49 | + $initializer = function(&$wrappedObject, LazyLoadingInterface $proxy, $method, array $parameters, &$initializer) use ($entity, $relation) { |
|
| 50 | 50 | $entityMap = Manager::getMapper($entity)->getEntityMap(); |
| 51 | 51 | |
| 52 | 52 | $wrappedObject = $entityMap->$relation($entity)->getResults($relation); |
@@ -185,7 +185,7 @@ |
||
| 185 | 185 | // Once we have the dictionary constructed, we can loop through all the parents |
| 186 | 186 | // and match back onto their children using these keys of the dictionary and |
| 187 | 187 | // the primary key of the children to map them onto the correct instances. |
| 188 | - return array_map(function ($result) use ($dictionary, $foreign, $relation) { |
|
| 188 | + return array_map(function($result) use ($dictionary, $foreign, $relation) { |
|
| 189 | 189 | if (isset($dictionary[$result[$foreign]])) { |
| 190 | 190 | $result[$relation] = $dictionary[$result[$foreign]]; |
| 191 | 191 | } else { |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | |
| 246 | 246 | $host = $this; |
| 247 | 247 | |
| 248 | - return array_unique(array_values(array_map(function ($value) use ($key, $host) { |
|
| 248 | + return array_unique(array_values(array_map(function($value) use ($key, $host) { |
|
| 249 | 249 | if (!$value instanceof InternallyMappable) { |
| 250 | 250 | $value = $host->factory->make($value); |
| 251 | 251 | } |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | $key = $this->relatedMap->getKeyName(); |
| 269 | 269 | } |
| 270 | 270 | |
| 271 | - return array_unique(array_values(array_map(function ($value) use ($key) { |
|
| 271 | + return array_unique(array_values(array_map(function($value) use ($key) { |
|
| 272 | 272 | return $value[$key]; |
| 273 | 273 | }, $results))); |
| 274 | 274 | } |