Passed
Push — ft/nomadic ( 8f7952...ec1acc )
by Philippe
50:44 queued 43:40
created
src/FlatReferences/FlatReferencePresenter.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 {
9 9
     public static function toSelectValues(Collection $collection): Collection
10 10
     {
11
-        return $collection->map(function (ProvidesFlatReference $item) {
11
+        return $collection->map(function(ProvidesFlatReference $item) {
12 12
             return [
13 13
                 'id'    => $item->flatReference()->get(),
14 14
                 'label' => $item->flatReferenceLabel(),
@@ -21,10 +21,10 @@  discard block
 block discarded – undo
21 21
     {
22 22
         $grouped = [];
23 23
 
24
-        static::toSelectValues($collection)->each(function ($item) use (&$grouped) {
24
+        static::toSelectValues($collection)->each(function($item) use (&$grouped) {
25 25
             if (isset($grouped[$item['group']])) {
26 26
                 $grouped[$item['group']]['values'][] = $item;
27
-            } else {
27
+            }else {
28 28
                 $grouped[$item['group']] = ['group' => $item['group'], 'values' => [$item]];
29 29
             }
30 30
         });
Please login to merge, or discard this patch.
src/FlatReferences/FlatReferenceCollection.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,16 +21,16 @@
 block discarded – undo
21 21
             $referenceStrings = [];
22 22
         }
23 23
 
24
-        return (new Collection($referenceStrings))->reject(function ($referenceString) {
24
+        return (new Collection($referenceStrings))->reject(function($referenceString) {
25 25
             return is_null($referenceString);
26
-        })->map(function ($referenceString) {
26
+        })->map(function($referenceString) {
27 27
             return FlatReferenceFactory::fromString($referenceString)->instance();
28 28
         });
29 29
     }
30 30
 
31 31
     public function toFlatReferences(): Collection
32 32
     {
33
-        return (new Collection($this->all()))->map(function (ProvidesFlatReference $item) {
33
+        return (new Collection($this->all()))->map(function(ProvidesFlatReference $item) {
34 34
             return $item->flatReference()->get();
35 35
         });
36 36
     }
Please login to merge, or discard this patch.
src/FlatReferences/FlatReferenceFactory.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
     public static function fromString(string $reference): FlatReference
8 8
     {
9 9
         if (false == strpos($reference, '@')) {
10
-            throw new \InvalidArgumentException('Invalid reference composition. A flat reference should honour schema <class>@<id>. [' . $reference . '] was passed instead.');
10
+            throw new \InvalidArgumentException('Invalid reference composition. A flat reference should honour schema <class>@<id>. ['.$reference.'] was passed instead.');
11 11
         }
12 12
 
13 13
         list($className, $id) = explode('@', $reference);
@@ -15,8 +15,8 @@  discard block
 block discarded – undo
15 15
         $instance = app($className);
16 16
         $instance->{$instance->getKeyName()} = $id;
17 17
 
18
-        if (! method_exists($instance, 'flatReference')) {
19
-            throw new \InvalidArgumentException('Instance created from model reference [' . $reference . '] was expected to have a method of flatReference() but is has not.');
18
+        if (!method_exists($instance, 'flatReference')) {
19
+            throw new \InvalidArgumentException('Instance created from model reference ['.$reference.'] was expected to have a method of flatReference() but is has not.');
20 20
         }
21 21
 
22 22
         return $instance->flatReference();
Please login to merge, or discard this patch.
src/Pages/PublishedFilter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
 
20 20
     public function apply($value = null): Closure
21 21
     {
22
-        return function ($query) use ($value) {
22
+        return function($query) use ($value) {
23 23
             if ($value == 'all') {
24 24
                 return $query;
25 25
             }
Please login to merge, or discard this patch.
src/Pages/Console/GeneratePage.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -37,10 +37,10 @@  discard block
 block discarded – undo
37 37
 
38 38
         // Set required paths
39 39
         $this->dirs = ['base' => $this->settings['base_path'] ?? base_path()];
40
-        $this->dirs['model'] = $this->settings['model_path'] ?? $this->dirs['base'] .'/'. config('thinktomorrow.chief.domain.path', 'src');
41
-        $this->dirs['views'] = $this->settings['views_path'] ?? $this->dirs['base'] . '/resources/views';
42
-        $this->dirs['controller'] = $this->settings['controller_path'] ?? $this->dirs['base'] . '/app/Http/Controllers';
43
-        $this->files['routes'] = $this->settings['routes_file'] ?? $this->dirs['base'] . '/routes/web.php';
40
+        $this->dirs['model'] = $this->settings['model_path'] ?? $this->dirs['base'].'/'.config('thinktomorrow.chief.domain.path', 'src');
41
+        $this->dirs['views'] = $this->settings['views_path'] ?? $this->dirs['base'].'/resources/views';
42
+        $this->dirs['controller'] = $this->settings['controller_path'] ?? $this->dirs['base'].'/app/Http/Controllers';
43
+        $this->files['routes'] = $this->settings['routes_file'] ?? $this->dirs['base'].'/routes/web.php';
44 44
     }
45 45
 
46 46
     public function handle()
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
     private function publishModel()
63 63
     {
64 64
         $this->publishFile(
65
-            __DIR__ . '/stubs/model.php.stub',
66
-            $to = $this->dirs['model'] . '/' . ucfirst($this->plural) . '/' . ucfirst($this->singular) . '.php',
65
+            __DIR__.'/stubs/model.php.stub',
66
+            $to = $this->dirs['model'].'/'.ucfirst($this->plural).'/'.ucfirst($this->singular).'.php',
67 67
             'model'
68 68
         );
69 69
 
@@ -73,8 +73,8 @@  discard block
 block discarded – undo
73 73
     private function publishController()
74 74
     {
75 75
         $this->publishFile(
76
-            __DIR__ . '/stubs/controller.php.stub',
77
-            $to = $this->dirs['controller'] . '/' . ucfirst($this->plural) . '/' . ucfirst($this->singular) . '.php',
76
+            __DIR__.'/stubs/controller.php.stub',
77
+            $to = $this->dirs['controller'].'/'.ucfirst($this->plural).'/'.ucfirst($this->singular).'.php',
78 78
             'controller'
79 79
         );
80 80
     }
@@ -113,8 +113,8 @@  discard block
 block discarded – undo
113 113
     private function modelTraits()
114 114
     {
115 115
         return [
116
-            '\\' . Publishable::class,
117
-            '\\' . Sortable::class,
116
+            '\\'.Publishable::class,
117
+            '\\'.Sortable::class,
118 118
             'q' => 'Proceed.',
119 119
         ];
120 120
     }
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
     protected function publishFile($from, $to, $type)
130 130
     {
131 131
         if ($this->filesystem->exists($to) && !$this->option('force')) {
132
-            if (!$this->confirm('File [' . $to . '] already exists? Overwrite this file?')) {
132
+            if (!$this->confirm('File ['.$to.'] already exists? Overwrite this file?')) {
133 133
                 return;
134 134
             }
135 135
         }
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 
169 169
         $to = str_replace($this->dirs['base'], '', realpath($to));
170 170
 
171
-        $this->line('<info>Copied ' . $type . '</info> <comment>[' . $from . ']</comment> <info>To</info> <comment>[' . $to . ']</comment>');
171
+        $this->line('<info>Copied '.$type.'</info> <comment>['.$from.']</comment> <info>To</info> <comment>['.$to.']</comment>');
172 172
     }
173 173
 
174 174
     protected function replacePlaceholders($content)
@@ -187,16 +187,16 @@  discard block
 block discarded – undo
187 187
     private function generateImportStatements(): string
188 188
     {
189 189
         return collect(['\\'.Page::class])
190
-            ->map(function ($statement) {
191
-                return 'use ' . $statement . ";\n    ";
190
+            ->map(function($statement) {
191
+                return 'use '.$statement.";\n    ";
192 192
             })->implode('');
193 193
     }
194 194
 
195 195
     private function generateTraitStatements(): string
196 196
     {
197 197
         return collect($this->chosenTraits)
198
-            ->map(function ($statement) {
199
-                return 'use ' . $statement . ";\n    ";
198
+            ->map(function($statement) {
199
+                return 'use '.$statement.";\n    ";
200 200
             })->implode('');
201 201
     }
202 202
 
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 
216 216
         // We make an estimated guess based on the project name. At Think Tomorrow, we
217 217
         // have a src folder which is PSR-4 namespaced by the project name itself.
218
-        return str_replace('\\\\', '\\', ucfirst(config('thinktomorrow.chief.domain.namespace', 'App')).'\\'. ucfirst($this->plural));
218
+        return str_replace('\\\\', '\\', ucfirst(config('thinktomorrow.chief.domain.namespace', 'App')).'\\'.ucfirst($this->plural));
219 219
     }
220 220
 
221 221
     private function addToConfig($configKey, $value)
Please login to merge, or discard this patch.
src/Sets/SetReference.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     {
35 35
         // Constraints
36 36
         if (!isset($values['action'])) {
37
-            throw new \InvalidArgumentException('Set reference array is missing required values for the "action" keys. Given: ' . print_r($values, true));
37
+            throw new \InvalidArgumentException('Set reference array is missing required values for the "action" keys. Given: '.print_r($values, true));
38 38
         }
39 39
 
40 40
         return new static(
@@ -49,14 +49,14 @@  discard block
 block discarded – undo
49 49
     {
50 50
         $sets = config('thinktomorrow.chief.sets', []);
51 51
 
52
-        return collect($sets)->map(function ($set, $key) {
52
+        return collect($sets)->map(function($set, $key) {
53 53
             return SetReference::fromArray($key, $set);
54 54
         });
55 55
     }
56 56
 
57 57
     public static function find($key): ?SetReference
58 58
     {
59
-        return static::all()->filter(function ($ref) use ($key) {
59
+        return static::all()->filter(function($ref) use ($key) {
60 60
             return $ref->key() == $key;
61 61
         })->first();
62 62
     }
@@ -73,9 +73,9 @@  discard block
 block discarded – undo
73 73
 
74 74
         $this->validateAction($class, $method);
75 75
 
76
-        $result = call_user_func_array([app($class),$method], $this->parameters);
76
+        $result = call_user_func_array([app($class), $method], $this->parameters);
77 77
 
78
-        if (! $result instanceof Set && $result instanceof Collection) {
78
+        if (!$result instanceof Set && $result instanceof Collection) {
79 79
             return new Set($result->all(), $this->key);
80 80
         }
81 81
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 
108 108
     private static function validateAction($class, $method)
109 109
     {
110
-        if (! class_exists($class)) {
110
+        if (!class_exists($class)) {
111 111
             throw new \InvalidArgumentException('The class ['.$class.'] isn\'t a valid class reference or does not exist in the chief-settings.sets config entry.');
112 112
         }
113 113
 
Please login to merge, or discard this patch.
src/Sets/StoredSetReference.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,12 +35,12 @@
 block discarded – undo
35 35
 
36 36
     public function toReference(): SetReference
37 37
     {
38
-        $reference = SetReference::all()->first(function ($setReference) {
38
+        $reference = SetReference::all()->first(function($setReference) {
39 39
             return $setReference->key() == $this->key;
40 40
         });
41 41
 
42 42
         if (!$reference) {
43
-            throw new \Exception('No query set found by key ['. $this->key. ']. Make sure that this '.$this->key.' set is added to the chief.sets config array.');
43
+            throw new \Exception('No query set found by key ['.$this->key.']. Make sure that this '.$this->key.' set is added to the chief.sets config array.');
44 44
         }
45 45
 
46 46
         return $reference;
Please login to merge, or discard this patch.
src/Authorization/Role.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 
19 19
     public static function rolesForSelect($includeDeveloperRole = false)
20 20
     {
21
-        $roles = $includeDeveloperRole ? static::all() : static::all()->reject(function ($role) {
21
+        $roles = $includeDeveloperRole ? static::all() : static::all()->reject(function($role) {
22 22
             return $role->name == 'developer';
23 23
         });
24 24
 
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 
40 40
     public function getPermissionsForIndex()
41 41
     {
42
-        $this->permissions->each(function ($permission) {
42
+        $this->permissions->each(function($permission) {
43 43
             $model = explode("_", $permission->name, 2)[1];
44 44
             $temp = $this->permission;
45 45
             $temp[$model][] = explode("_", $permission->name, 2)[0];
Please login to merge, or discard this patch.
src/Filters/Types/InputFilter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
 
16 16
     public function apply($value = null): Closure
17 17
     {
18
-        return $this->query && $this->query instanceof Closure ? $this->query : function ($query) {
18
+        return $this->query && $this->query instanceof Closure ? $this->query : function($query) {
19 19
             return $query;
20 20
         };
21 21
     }
Please login to merge, or discard this patch.