Passed
Pull Request — master (#303)
by Ben
35:24
created
src/Pages/PageManager.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -63,15 +63,15 @@  discard block
 block discarded – undo
63 63
     {
64 64
         $permission = 'update-page';
65 65
 
66
-        if (in_array($verb, ['index','show'])) {
66
+        if (in_array($verb, ['index', 'show'])) {
67 67
             $permission = 'view-page';
68
-        } elseif (in_array($verb, ['create','store'])) {
68
+        } elseif (in_array($verb, ['create', 'store'])) {
69 69
             $permission = 'create-page';
70 70
         } elseif (in_array($verb, ['delete'])) {
71 71
             $permission = 'delete-page';
72 72
         }
73 73
 
74
-        if (! auth()->guard('chief')->user()->hasPermissionTo($permission)) {
74
+        if (!auth()->guard('chief')->user()->hasPermissionTo($permission)) {
75 75
             throw NotAllowedManagerRoute::notAllowedPermission($permission, $this);
76 76
         }
77 77
     }
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
     public function fieldArrangement($key = null): FieldArrangement
134 134
     {
135 135
         if ($key == 'create') {
136
-            return new FieldArrangement($this->fieldsWithAssistantFields()->filterBy(function ($field) {
136
+            return new FieldArrangement($this->fieldsWithAssistantFields()->filterBy(function($field) {
137 137
                 return in_array($field->key, ['title']);
138 138
             }));
139 139
         }
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
     public function saveFields(Request $request)
166 166
     {
167 167
         // Store the morph_key upon creation
168
-        if ($this->model instanceof MorphableContract && ! $this->model->morph_key) {
168
+        if ($this->model instanceof MorphableContract && !$this->model->morph_key) {
169 169
             $this->model->morph_key = $this->model->morphKey();
170 170
         }
171 171
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
             if (is_array_empty($translation)) {
211 211
 
212 212
                 // Nullify all values
213
-                $trans[$locale] = array_map(function ($value) {
213
+                $trans[$locale] = array_map(function($value) {
214 214
                     return null;
215 215
                 }, $translation);
216 216
                 continue;
Please login to merge, or discard this patch.
src/Management/Assistants/ArchiveAssistant.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
         $this->manager  = $manager;
32 32
         $this->model    = $manager->model();
33 33
 
34
-        if(!$this->model instanceof StatefulContract){
34
+        if (!$this->model instanceof StatefulContract) {
35 35
             throw new \InvalidArgumentException('ArchiveAssistant requires the model to implement the StatefulContract.');
36 36
         }
37 37
     }
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 
68 68
     public function findAll(): Collection
69 69
     {
70
-        return $this->model->archived()->get()->map(function ($model) {
70
+        return $this->model->archived()->get()->map(function($model) {
71 71
             return $this->managers->findByModel($model);
72 72
         });
73 73
     }
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 
98 98
     public function guard($verb): Assistant
99 99
     {
100
-        if (! $this->can($verb)) {
100
+        if (!$this->can($verb)) {
101 101
             NotAllowedManagerRoute::notAllowedVerb($verb, $this->manager);
102 102
         }
103 103
 
Please login to merge, or discard this patch.
src/Management/Assistants/PublishAssistant.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
         $this->manager = $manager;
34 34
         $this->model = $manager->model();
35 35
 
36
-        if(!$this->model instanceof StatefulContract){
36
+        if (!$this->model instanceof StatefulContract) {
37 37
             throw new \InvalidArgumentException('PublishAssistant requires the model to implement the StatefulContract.');
38 38
         }
39 39
     }
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 
75 75
     public function findAll(): Collection
76 76
     {
77
-        return $this->model->published()->get()->map(function ($model) {
77
+        return $this->model->published()->get()->map(function($model) {
78 78
             return $this->managers->findByModel($model);
79 79
         });
80 80
     }
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 
97 97
     public function guard($verb): Assistant
98 98
     {
99
-        if (! $this->can($verb)) {
99
+        if (!$this->can($verb)) {
100 100
             NotAllowedManagerRoute::notAllowedVerb($verb, $this->manager);
101 101
         }
102 102
 
@@ -121,10 +121,10 @@  discard block
 block discarded – undo
121 121
             $class = 'text-warning';
122 122
         }
123 123
 
124
-        $statusAsLabel = '<span class="font-bold '. $class .'"><em>' . $label . '</em></span>';
124
+        $statusAsLabel = '<span class="font-bold '.$class.'"><em>'.$label.'</em></span>';
125 125
 
126 126
         if (!$plain && $this->hasPreviewUrl()) {
127
-            $statusAsLabel =  '<a href="'.$this->previewUrl().'" target="_blank">'. $statusAsLabel .'</a>';
127
+            $statusAsLabel = '<a href="'.$this->previewUrl().'" target="_blank">'.$statusAsLabel.'</a>';
128 128
         }
129 129
 
130 130
         return $statusAsLabel;
Please login to merge, or discard this patch.
src/States/State/StateMachine.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@
 block discarded – undo
89 89
     {
90 90
         $transitions = [];
91 91
 
92
-        foreach($this->transitions as $transitionKey => $transition){
92
+        foreach ($this->transitions as $transitionKey => $transition) {
93 93
             if (false !== array_search($this->statefulContract->state(), $transition['from'])) {
94 94
                 $transitions[] = $transitionKey;
95 95
             }
Please login to merge, or discard this patch.
src/States/PageStatePresenter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
     {
29 29
         $class = $this->pageState->isOnline() ? 'text-success' : 'text-warning';
30 30
 
31
-        return '<span class="inline-xs stack-s '.$class.'">' . $this->stateAsLabel() . '</span>';
31
+        return '<span class="inline-xs stack-s '.$class.'">'.$this->stateAsLabel().'</span>';
32 32
     }
33 33
 
34 34
     /**
Please login to merge, or discard this patch.
src/Management/Application/DeleteManagedModel.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
             DB::beginTransaction();
22 22
 
23 23
             // For stateful transitions we will apply this deletion as a state
24
-            if($model instanceof StatefulContract) {
24
+            if ($model instanceof StatefulContract) {
25 25
                 (new PageState($model))->apply('delete');
26 26
                 $model->save();
27 27
             }
@@ -29,17 +29,17 @@  discard block
 block discarded – undo
29 29
             Relation::deleteRelationsOf($model->getMorphClass(), $model->id);
30 30
 
31 31
             // Mark the slug as deleted to avoid any conflict with newly created modules with the same slug.
32
-            if($model instanceof Module) {
32
+            if ($model instanceof Module) {
33 33
                 $model->update([
34
-                    'slug' => $model->slug . $this->appendDeleteMarker(),
34
+                    'slug' => $model->slug.$this->appendDeleteMarker(),
35 35
                 ]);
36 36
             }
37 37
 
38
-            if($model instanceof ProvidesUrl){
38
+            if ($model instanceof ProvidesUrl) {
39 39
                 UrlRecord::getByModel($model)->each->delete();
40 40
             }
41 41
 
42
-            if($model instanceof Page){
42
+            if ($model instanceof Page) {
43 43
                 Module::where('page_id', $model->id)->delete();
44 44
             }
45 45
 
@@ -58,6 +58,6 @@  discard block
 block discarded – undo
58 58
 
59 59
     private function appendDeleteMarker(): string
60 60
     {
61
-        return '_DELETED_' . time();
61
+        return '_DELETED_'.time();
62 62
     }
63 63
 }
Please login to merge, or discard this patch.
src/States/Archivable/Archivable.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
 
24 24
     public function scopeUnarchived($query)
25 25
     {
26
-        $query->withoutGlobalScope(ArchiveScope::class)->where('current_state','<>', PageState::ARCHIVED);
26
+        $query->withoutGlobalScope(ArchiveScope::class)->where('current_state', '<>', PageState::ARCHIVED);
27 27
     }
28 28
 
29 29
     public function scopeWithArchived($query)
Please login to merge, or discard this patch.
src/States/Archivable/ArchiveScope.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types = 1);
3
+declare(strict_types=1);
4 4
 
5 5
 namespace Thinktomorrow\Chief\States\Archivable;
6 6
 
@@ -13,6 +13,6 @@  discard block
 block discarded – undo
13 13
 {
14 14
     public function apply(Builder $builder, Model $model)
15 15
     {
16
-        $builder->where('current_state','<>', PageState::ARCHIVED);
16
+        $builder->where('current_state', '<>', PageState::ARCHIVED);
17 17
     }
18 18
 }
Please login to merge, or discard this patch.