Completed
Pull Request — refacto/local-factory (#165)
by Nuno
129:53 queued 125:51
created
Category
src/Settings/Compiler.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 
85 85
         $indexChangedSettings = [];
86 86
         foreach ($settings->changed() as $setting => $value) {
87
-            if (! array_key_exists($setting, $viewParams)) {
87
+            if ( ! array_key_exists($setting, $viewParams)) {
88 88
                 $indexChangedSettings[$setting] = $value;
89 89
             }
90 90
         }
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 
116 116
         array_pop($matches[2]);
117 117
 
118
-        return array_map(function ($match) {
118
+        return array_map(function($match) {
119 119
             return ltrim(explode(' ', $match)[0], '$');
120 120
         }, $matches[2]);
121 121
     }
Please login to merge, or discard this patch.
src/Helpers/SearchableFinder.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@
 block discarded – undo
75 75
     {
76 76
         $appNamespace = $this->app->getNamespace();
77 77
 
78
-        return array_values(array_filter($this->getProjectClasses(), function (string $class) use ($appNamespace) {
78
+        return array_values(array_filter($this->getProjectClasses(), function(string $class) use ($appNamespace) {
79 79
             return Str::startsWith($class, $appNamespace) && $this->isSearchableModel($class);
80 80
         }));
81 81
     }
Please login to merge, or discard this patch.
src/Searchable/RecordsCounter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
         } else {
38 38
             $softDeletes = in_array(SoftDeletes::class, class_uses_recursive($searchable), true) && config('scout.soft_delete', false);
39 39
 
40
-            $count = $searchable::query()->when($softDeletes, function ($query) {
40
+            $count = $searchable::query()->when($softDeletes, function($query) {
41 41
                 $query->withTrashed();
42 42
             })->count();
43 43
         }
Please login to merge, or discard this patch.
src/Searchable/AggregatorObserver.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
     public function setAggregator(string $aggregator, array $models): void
40 40
     {
41 41
         foreach ($models as $model) {
42
-            if (! array_key_exists($model, $this->aggregators)) {
42
+            if ( ! array_key_exists($model, $this->aggregators)) {
43 43
                 $this->aggregators[$model] = [];
44 44
             }
45 45
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
     {
55 55
         $class = get_class($model);
56 56
 
57
-        if (! array_key_exists($class, $this->aggregators)) {
57
+        if ( ! array_key_exists($class, $this->aggregators)) {
58 58
             return;
59 59
         }
60 60
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
         } else {
78 78
             $class = get_class($model);
79 79
 
80
-            if (! array_key_exists($class, $this->aggregators)) {
80
+            if ( ! array_key_exists($class, $this->aggregators)) {
81 81
                 return;
82 82
             }
83 83
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 
102 102
         $class = get_class($model);
103 103
 
104
-        if (! array_key_exists($class, $this->aggregators)) {
104
+        if ( ! array_key_exists($class, $this->aggregators)) {
105 105
             return;
106 106
         }
107 107
 
Please login to merge, or discard this patch.
src/Settings/Settings.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
             }
73 73
         }
74 74
 
75
-        return array_filter($settings, function ($value, $setting) {
75
+        return array_filter($settings, function($value, $setting) {
76 76
             return ! in_array($setting, self::$ignore, true);
77 77
         }, ARRAY_FILTER_USE_BOTH);
78 78
     }
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
      */
85 85
     public function changed(): array
86 86
     {
87
-        return array_filter($this->all(), function ($value, $setting) {
87
+        return array_filter($this->all(), function($value, $setting) {
88 88
             return ! array_key_exists($setting, $this->defaults) || $value !== $this->defaults[$setting];
89 89
         }, ARRAY_FILTER_USE_BOTH);
90 90
     }
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         $viewVariables = Compiler::getViewVariables();
100 100
         $changed = $this->changed();
101 101
 
102
-        $compiled = array_filter($this->all(), function ($value, $setting) use ($viewVariables, $changed) {
102
+        $compiled = array_filter($this->all(), function($value, $setting) use ($viewVariables, $changed) {
103 103
             return in_array($setting, $viewVariables, true) || array_key_exists($setting, $changed);
104 104
         }, ARRAY_FILTER_USE_BOTH);
105 105
 
Please login to merge, or discard this patch.
src/Settings/LocalFactory.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -261,8 +261,7 @@
 block discarded – undo
261 261
                 throw tap(new ModelNotFoundException())->setModel($searchable);
262 262
             }
263 263
 
264
-            $attributes = method_exists($instance, 'toSearchableArray') ? $instance->toSearchableArray() :
265
-                $instance->toArray();
264
+            $attributes = method_exists($instance, 'toSearchableArray') ? $instance->toSearchableArray() : $instance->toArray();
266 265
         }
267 266
 
268 267
         return $attributes;
Please login to merge, or discard this patch.
src/Searchable/Aggregator.php 1 patch
Spacing   +5 added lines, -6 removed lines patch added patch discarded remove patch
@@ -150,8 +150,7 @@  discard block
 block discarded – undo
150 150
             throw new ModelNotDefinedInAggregatorException();
151 151
         }
152 152
 
153
-        return method_exists($this->model, 'toSearchableArray') ? $this->model->toSearchableArray() :
154
-            $this->model->toArray();
153
+        return method_exists($this->model, 'toSearchableArray') ? $this->model->toSearchableArray() : $this->model->toArray();
155 154
     }
156 155
 
157 156
     /**
@@ -167,10 +166,10 @@  discard block
 block discarded – undo
167 166
             $softDeletes =
168 167
                 in_array(SoftDeletes::class, class_uses_recursive($model)) && config('scout.soft_delete', false);
169 168
 
170
-            $instance->newQuery()->when($softDeletes, function ($query) {
169
+            $instance->newQuery()->when($softDeletes, function($query) {
171 170
                 $query->withTrashed();
172
-            })->orderBy($instance->getKeyName())->chunk(config('scout.chunk.searchable', 500), function ($models) {
173
-                $models = $models->map(function ($model) {
171
+            })->orderBy($instance->getKeyName())->chunk(config('scout.chunk.searchable', 500), function($models) {
172
+                $models = $models->map(function($model) {
174 173
                     return static::create($model);
175 174
                 })->filter->shouldBeSearchable();
176 175
 
@@ -192,7 +191,7 @@  discard block
 block discarded – undo
192 191
             $softDeletes =
193 192
                 in_array(SoftDeletes::class, class_uses_recursive($model), true) && config('scout.soft_delete', false);
194 193
 
195
-            $count += $model::query()->when($softDeletes, function ($query) {
194
+            $count += $model::query()->when($softDeletes, function($query) {
196 195
                 $query->withTrashed();
197 196
             })->count();
198 197
         }
Please login to merge, or discard this patch.
src/Searchable/AggregatorCollection.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
     {
43 43
         $this->aggregator = get_class($this->first());
44 44
 
45
-        $this->items = $this->getSerializedPropertyValue(EloquentCollection::make($this->map(function ($aggregator) {
45
+        $this->items = $this->getSerializedPropertyValue(EloquentCollection::make($this->map(function($aggregator) {
46 46
             return $aggregator->getModel();
47 47
         })));
48 48
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
      */
57 57
     public function __wakeup()
58 58
     {
59
-        $this->items = $this->getRestoredPropertyValue($this->items)->map(function ($model) {
59
+        $this->items = $this->getRestoredPropertyValue($this->items)->map(function($model) {
60 60
             return $this->aggregator::create($model);
61 61
         })->toArray();
62 62
     }
Please login to merge, or discard this patch.
src/Jobs/UpdateJob.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
                 continue;
107 107
             }
108 108
 
109
-            if (! $this->hasToSearchableArray($searchable)) {
109
+            if ( ! $this->hasToSearchableArray($searchable)) {
110 110
                 $array = $searchable->getModel()->transform($array);
111 111
             }
112 112
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
     {
146 146
         $class = get_class($searchable->getModel());
147 147
 
148
-        if (! array_key_exists($class, $this->splittables)) {
148
+        if ( ! array_key_exists($class, $this->splittables)) {
149 149
             $this->splittables[$class] = false;
150 150
 
151 151
             foreach ($searchable->toSearchableArray() as $key => $value) {
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
             $objects = $temp;
203 203
         }
204 204
 
205
-        return array_map(function ($object) use ($array) {
205
+        return array_map(function($object) use ($array) {
206 206
             return array_merge($array, $object);
207 207
         }, $objects);
208 208
     }
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
     {
229 229
         $searchableClass = get_class($searchable);
230 230
 
231
-        if (! array_key_exists($searchableClass, $this->searchablesWithToSearchableArray)) {
231
+        if ( ! array_key_exists($searchableClass, $this->searchablesWithToSearchableArray)) {
232 232
             $reflectionClass = new ReflectionClass(get_class($searchable));
233 233
 
234 234
             $this->searchablesWithToSearchableArray[$searchableClass] =
Please login to merge, or discard this patch.