Completed
Pull Request — master (#414)
by Philippe
32:33 queued 15:43
created
src/Modules/ModuleManager.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
          * Therefore the index of these modules is at the modules tab of this page model.
34 34
          */
35 35
         if ($verb == 'index' && $this->model->isPageSpecific()) {
36
-            return app(Managers::class)->findByModel($this->model->page)->route('edit') . '#eigen-modules';
36
+            return app(Managers::class)->findByModel($this->model->page)->route('edit').'#eigen-modules';
37 37
         }
38 38
 
39 39
         $routes = [
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
             if (is_array_empty($translation)) {
154 154
 
155 155
                 // Nullify all values
156
-                $trans[$locale] = array_map(function ($value) {
156
+                $trans[$locale] = array_map(function($value) {
157 157
                     return null;
158 158
                 }, $translation);
159 159
                 continue;
Please login to merge, or discard this patch.
src/Modules/Module.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
             return static::$managedModelKey;
70 70
         }
71 71
 
72
-        throw new \Exception('Missing required static property \'managedModelKey\' on ' . static::class . '.');
72
+        throw new \Exception('Missing required static property \'managedModelKey\' on '.static::class.'.');
73 73
     }
74 74
 
75 75
     /**
@@ -79,9 +79,9 @@  discard block
 block discarded – undo
79 79
      */
80 80
     public static function availableForCreation(): Collection
81 81
     {
82
-        $managers = app(Managers::class)->findByTag('module')->filter(function ($manager) {
82
+        $managers = app(Managers::class)->findByTag('module')->filter(function($manager) {
83 83
             return $manager->can('create');
84
-        })->map(function ($manager) {
84
+        })->map(function($manager) {
85 85
             return $manager->details();
86 86
         });
87 87
 
Please login to merge, or discard this patch.
src/Management/Assistants/ArchiveAssistant.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
     public function findAllArchived(): Collection
51 51
     {
52
-        return $this->manager->modelInstance()::archived()->get()->map(function ($model) {
52
+        return $this->manager->modelInstance()::archived()->get()->map(function($model) {
53 53
             return $this->managers->findByModel($model);
54 54
         });
55 55
     }
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
     private function guard($verb): Assistant
91 91
     {
92 92
         if (!$this->manager->existingModel() instanceof StatefulContract) {
93
-            throw new \InvalidArgumentException('ArchiveAssistant requires the model to implement the StatefulContract. [' . get_class($this->manager->existingModel()) . '] given instead.');
93
+            throw new \InvalidArgumentException('ArchiveAssistant requires the model to implement the StatefulContract. ['.get_class($this->manager->existingModel()).'] given instead.');
94 94
         }
95 95
 
96 96
         if (!$this->can($verb)) {
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 
121 121
             // Ok now get all urls from this model and point them to the new records
122 122
             foreach (UrlRecord::getByModel($this->manager->existingModel()) as $urlRecord) {
123
-                if ($targetRecord = $targetRecords->first(function ($record) use ($urlRecord) {
123
+                if ($targetRecord = $targetRecords->first(function($record) use ($urlRecord) {
124 124
                     return ($record->locale == $urlRecord->locale && !$record->isRedirect());
125 125
                 })) {
126 126
                     $urlRecord->redirectTo($targetRecord);
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
             ->performedOn($this->manager->existingModel())
138 138
             ->log('archived');
139 139
 
140
-        return redirect()->to($this->manager->route('index'))->with('messages.success', $this->manager->details()->title . ' is gearchiveerd.');
140
+        return redirect()->to($this->manager->route('index'))->with('messages.success', $this->manager->details()->title.' is gearchiveerd.');
141 141
     }
142 142
 
143 143
     public function unarchive()
@@ -153,6 +153,6 @@  discard block
 block discarded – undo
153 153
             ->performedOn($this->manager->existingModel())
154 154
             ->log('unarchived');
155 155
 
156
-        return redirect()->to($this->manager->route('index'))->with('messages.success', $this->manager->details()->title . ' is hersteld.');
156
+        return redirect()->to($this->manager->route('index'))->with('messages.success', $this->manager->details()->title.' is hersteld.');
157 157
     }
158 158
 }
Please login to merge, or discard this patch.
src/Management/Registration.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -75,21 +75,21 @@
 block discarded – undo
75 75
     private function validate($managerClass, $modelClass)
76 76
     {
77 77
         if (!class_exists($managerClass)) {
78
-            throw new \InvalidArgumentException('Manager class [' . $managerClass . '] is an invalid class reference. Please make sure the class exists.');
78
+            throw new \InvalidArgumentException('Manager class ['.$managerClass.'] is an invalid class reference. Please make sure the class exists.');
79 79
         }
80 80
 
81 81
         if (!class_exists($modelClass)) {
82
-            throw new \InvalidArgumentException('Model class [' . $modelClass . '] is an invalid model reference. Please make sure the class exists.');
82
+            throw new \InvalidArgumentException('Model class ['.$modelClass.'] is an invalid model reference. Please make sure the class exists.');
83 83
         }
84 84
 
85 85
         $manager = new \ReflectionClass($managerClass);
86 86
         if (!$manager->implementsInterface(Manager::class)) {
87
-            throw new \InvalidArgumentException('Class [' . $managerClass . '] is expected to implement the [' . Manager::class . '] contract.');
87
+            throw new \InvalidArgumentException('Class ['.$managerClass.'] is expected to implement the ['.Manager::class.'] contract.');
88 88
         }
89 89
 
90 90
         $model = new \ReflectionClass($modelClass);
91 91
         if (!$model->implementsInterface(ManagedModel::class)) {
92
-            throw new \InvalidArgumentException('Class [' . $modelClass . '] is expected to implement the [' . ManagedModel::class . '] contract.');
92
+            throw new \InvalidArgumentException('Class ['.$modelClass.'] is expected to implement the ['.ManagedModel::class.'] contract.');
93 93
         }
94 94
     }
95 95
 }
Please login to merge, or discard this patch.
src/Management/Register.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@
 block discarded – undo
136 136
     private function registrationMustExistConstraint(string $key, $value, $registrations): void
137 137
     {
138 138
         if (empty($registrations) && count($registrations) != $this->registrations) {
139
-            throw new NonRegisteredManager('No manager found for ' . $key . ' [' . print_r($value, true) . ']. Did you perhaps forgot to register the manager?');
139
+            throw new NonRegisteredManager('No manager found for '.$key.' ['.print_r($value, true).']. Did you perhaps forgot to register the manager?');
140 140
         }
141 141
     }
142 142
 }
Please login to merge, or discard this patch.
src/Management/AbstractManager.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
             return $this->indexPagination($builder);
89 89
         }
90 90
 
91
-        return $builder->get()->map(function ($model) {
91
+        return $builder->get()->map(function($model) {
92 92
             return (new static($this->registration))->manage($model);
93 93
         });
94 94
     }
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
     {
117 117
         $paginator = $builder->paginate($this->pageCount);
118 118
 
119
-        $modifiedCollection = $builder->paginate($this->pageCount)->getCollection()->transform(function ($model) {
119
+        $modifiedCollection = $builder->paginate($this->pageCount)->getCollection()->transform(function($model) {
120 120
             return (new static($this->registration))->manage($model);
121 121
         });
122 122
 
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
             static::$bootedTraitMethods[$baseMethod] = [];
308 308
 
309 309
             foreach (class_uses_recursive($class) as $trait) {
310
-                $method = class_basename($trait) . ucfirst($baseMethod);
310
+                $method = class_basename($trait).ucfirst($baseMethod);
311 311
 
312 312
                 if (method_exists($class, $method) && !in_array($method, static::$bootedTraitMethods[$baseMethod])) {
313 313
                     static::$bootedTraitMethods[$baseMethod][] = lcfirst($method);
Please login to merge, or discard this patch.
src/Management/Details/HasDetails.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
         $genericModelInstance = $this->modelInstance();
17 17
 
18 18
         // Generic model details
19
-        $id = Str::slug($this->registration->key() . ($this->hasExistingModel() ? '-' . $this->existingModel()->id : ''));
19
+        $id = Str::slug($this->registration->key().($this->hasExistingModel() ? '-'.$this->existingModel()->id : ''));
20 20
         $key = $this->registration->key();
21 21
         $labelSingular = property_exists($genericModelInstance, 'labelSingular') ? $genericModelInstance->labelSingular : Str::singular($key);
22 22
         $labelPlural = property_exists($genericModelInstance, 'labelPlural') ? $genericModelInstance->labelPlural : Str::plural($key);
@@ -32,10 +32,10 @@  discard block
 block discarded – undo
32 32
         return new Details(
33 33
             $id,
34 34
             $key,
35
-            $labelSingular . '',
36
-            $labelPlural . '',
35
+            $labelSingular.'',
36
+            $labelPlural.'',
37 37
             $internal_label,
38
-            $title . ''
38
+            $title.''
39 39
         );
40 40
     }
41 41
 }
Please login to merge, or discard this patch.
src/Nav/Nav.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -52,9 +52,9 @@  discard block
 block discarded – undo
52 52
 
53 53
     private static function fromManagers(Collection $collection)
54 54
     {
55
-        return new static(...$collection->reject(function ($manager) {
55
+        return new static(...$collection->reject(function($manager) {
56 56
             return !$manager->can('index');
57
-        })->map(function ($manager) {
57
+        })->map(function($manager) {
58 58
             return new NavItem($manager->details()->plural, $manager->route('index'), [
59 59
                 'key'  => $manager->details()->key,
60 60
                 'tags' => app(Register::class)->filterByKey($manager->details()->key)->first()->tags(),
@@ -119,12 +119,12 @@  discard block
 block discarded – undo
119 119
         $output = '';
120 120
 
121 121
         foreach ($this->items as $item) {
122
-            $output .= '<a class="' . (isActiveUrl($item->url()) ? 'active' : '') . '" href="' . $item->url() . '">';
122
+            $output .= '<a class="'.(isActiveUrl($item->url()) ? 'active' : '').'" href="'.$item->url().'">';
123 123
             $output .= $title ?? ucfirst($item->title());
124 124
             $output .= '</a>';
125 125
         }
126 126
 
127
-        return '<li>' . $output . '</li>';
127
+        return '<li>'.$output.'</li>';
128 128
     }
129 129
 
130 130
     /**
@@ -146,19 +146,19 @@  discard block
 block discarded – undo
146 146
 
147 147
         $items = '';
148 148
         foreach ($this->items as $item) {
149
-            $items .= '<a class="' . (isActiveUrl($item->url()) ? 'active' : '') . '" href="' . $item->url() . '">';
149
+            $items .= '<a class="'.(isActiveUrl($item->url()) ? 'active' : '').'" href="'.$item->url().'">';
150 150
             $items .= ucfirst($item->title());
151 151
             $items .= '</a>';
152 152
         }
153 153
 
154 154
         // Surround within vue dropdown
155 155
         $output = '<dropdown>';
156
-        $output .= '<span class="center-y nav-item" slot="trigger" slot-scope="{ toggle, isActive }" @click="toggle">' . ($title ?? 'Collecties') . '</span>';
156
+        $output .= '<span class="center-y nav-item" slot="trigger" slot-scope="{ toggle, isActive }" @click="toggle">'.($title ?? 'Collecties').'</span>';
157 157
         $output .= '<div v-cloak class="dropdown-box inset-s">';
158 158
         $output .= $items;
159 159
         $output .= '</div>';
160 160
         $output .= '</dropdown>';
161 161
 
162
-        return '<li>' . $output . '</li>';
162
+        return '<li>'.$output.'</li>';
163 163
     }
164 164
 }
Please login to merge, or discard this patch.
src/Relations/Relation.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
             ->orderBy('sort', 'ASC')
53 53
             ->get();
54 54
 
55
-        return $relations->map(function (Relation $relation) {
55
+        return $relations->map(function(Relation $relation) {
56 56
             $parent = $relation->parent;
57 57
             $parent->relation = $relation;
58 58
 
@@ -67,14 +67,14 @@  discard block
 block discarded – undo
67 67
             ->orderBy('sort', 'ASC')
68 68
             ->get();
69 69
 
70
-        return $relations->map(function (Relation $relation) use ($parent_type, $parent_id) {
70
+        return $relations->map(function(Relation $relation) use ($parent_type, $parent_id) {
71 71
 
72 72
             // It could be that the child itself is soft-deleted, if this is the case, we will ignore it and move on.
73 73
             if (!$child = $relation->child) {
74 74
                 if (!$relation->child()->withTrashed()->first()) {
75 75
 //                if ((!method_exists($childInstance, 'trashed')) || ! $childInstance->onlyTrashed()->find($relation->child_id)) {
76 76
                     // If we cannot retrieve it then he collection type is possibly off, this is a database inconsistency and should be addressed
77
-                    throw new \DomainException('Corrupt relation reference. Related child [' . $relation->child_type . '@' . $relation->child_id . '] could not be retrieved for parent [' . $parent_type . '@' . $parent_id . ']. Make sure the morph key can resolve to a valid class.');
77
+                    throw new \DomainException('Corrupt relation reference. Related child ['.$relation->child_type.'@'.$relation->child_id.'] could not be retrieved for parent ['.$parent_type.'@'.$parent_id.']. Make sure the morph key can resolve to a valid class.');
78 78
                 }
79 79
 
80 80
                 return null;
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
         })
87 87
 
88 88
             // In case of soft-deleted entries, this will be null and should be ignored. We make sure that keys are reset in case of removed child
89
-            ->reject(function ($child) {
89
+            ->reject(function($child) {
90 90
                 return is_null($child);
91 91
             })
92 92
             ->values();
@@ -103,10 +103,10 @@  discard block
 block discarded – undo
103 103
 
104 104
     public static function deleteRelationsOf($type, $id)
105 105
     {
106
-        $relations = static::where(function ($query) use ($type, $id) {
106
+        $relations = static::where(function($query) use ($type, $id) {
107 107
             return $query->where('parent_type', $type)
108 108
                 ->where('parent_id', $id);
109
-        })->orWhere(function ($query) use ($type, $id) {
109
+        })->orWhere(function($query) use ($type, $id) {
110 110
             return $query->where('child_type', $type)
111 111
                 ->where('child_id', $id);
112 112
         })->get();
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 
119 119
     public static function deleteAllChildRelationsOf($type, $id)
120 120
     {
121
-        $relations = static::where(function ($query) use ($type, $id) {
121
+        $relations = static::where(function($query) use ($type, $id) {
122 122
             return $query->where('parent_type', $type)
123 123
                 ->where('parent_id', $id);
124 124
         })->get();
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 
131 131
     public static function deleteAllParentRelationsOf($type, $id)
132 132
     {
133
-        $relations = static::where(function ($query) use ($type, $id) {
133
+        $relations = static::where(function($query) use ($type, $id) {
134 134
             return $query->where('child_type', $type)
135 135
                 ->where('child_id', $id);
136 136
         })->get();
Please login to merge, or discard this patch.