Completed
Pull Request — master (#334)
by Philippe
93:25 queued 50:53
created
src/Management/AbstractManager.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
             return $this->indexPagination($builder);
85 85
         }
86 86
 
87
-        return $builder->get()->map(function ($model) {
87
+        return $builder->get()->map(function($model) {
88 88
             return (new static($this->registration))->manage($model);
89 89
         });
90 90
     }
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
     {
113 113
         $paginator = $builder->paginate($this->pageCount);
114 114
 
115
-        $modifiedCollection = $builder->paginate($this->pageCount)->getCollection()->transform(function ($model) {
115
+        $modifiedCollection = $builder->paginate($this->pageCount)->getCollection()->transform(function($model) {
116 116
             return (new static($this->registration))->manage($model);
117 117
         });
118 118
 
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
     public function can($verb): bool
179 179
     {
180 180
         foreach (static::$bootedTraitMethods['can'] as $method) {
181
-            if(!method_exists($this, $method)) continue;
181
+            if (!method_exists($this, $method)) continue;
182 182
             $this->$method($verb);
183 183
         }
184 184
 
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 
188 188
     public function guard($verb): Manager
189 189
     {
190
-        if (! $this->can($verb)) {
190
+        if (!$this->can($verb)) {
191 191
             NotAllowedManagerRoute::notAllowedVerb($verb, $this);
192 192
         }
193 193
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
         $fields = $this->fields();
211 211
 
212 212
         foreach ($this->assistants() as $assistant) {
213
-            if (! method_exists($assistant, 'fields')) {
213
+            if (!method_exists($assistant, 'fields')) {
214 214
                 continue;
215 215
             }
216 216
 
@@ -292,9 +292,9 @@  discard block
 block discarded – undo
292 292
             static::$bootedTraitMethods[$baseMethod] = [];
293 293
 
294 294
             foreach (class_uses_recursive($class) as $trait) {
295
-                $method = class_basename($trait) . ucfirst($baseMethod);
295
+                $method = class_basename($trait).ucfirst($baseMethod);
296 296
 
297
-                if (method_exists($class, $method) && ! in_array($method, static::$bootedTraitMethods[$baseMethod])) {
297
+                if (method_exists($class, $method) && !in_array($method, static::$bootedTraitMethods[$baseMethod])) {
298 298
                     static::$bootedTraitMethods[$baseMethod][] = lcfirst($method);
299 299
                 }
300 300
             }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -178,7 +178,9 @@
 block discarded – undo
178 178
     public function can($verb): bool
179 179
     {
180 180
         foreach (static::$bootedTraitMethods['can'] as $method) {
181
-            if(!method_exists($this, $method)) continue;
181
+            if(!method_exists($this, $method)) {
182
+                continue;
183
+            }
182 184
             $this->$method($verb);
183 185
         }
184 186
 
Please login to merge, or discard this patch.
src/Media/UploadMedia.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
         if (is_string($file)) {
113 113
             $image_name = json_decode($file)->output->name;
114 114
             $asset      = app(AddAsset::class)->add($model, json_decode($file)->output->image, $type, $locale, $this->sluggifyFilename($image_name));
115
-        } else {
115
+        }else {
116 116
             if ($file instanceof UploadedFile) {
117 117
                 $image_name = $file->getClientOriginalName();
118 118
                 $asset      = app(AddAsset::class)->add($model, $file, $type, $locale, $this->sluggifyFilename($image_name));
@@ -120,9 +120,9 @@  discard block
 block discarded – undo
120 120
                 // New files are passed with their filename (instead of their id)
121 121
                 // For new files we will replace the filename with the id.
122 122
                 if (false !== ($key = array_search($image_name, $files_order))) {
123
-                    $files_order[$key] = (string) $asset->id;
123
+                    $files_order[$key] = (string)$asset->id;
124 124
                 }
125
-            } else {
125
+            }else {
126 126
                 $file       = Asset::findOrFail($file);
127 127
                 $asset      = app(AddAsset::class)->add($model, $file, $type, $locale);
128 128
             }
@@ -135,9 +135,9 @@  discard block
 block discarded – undo
135 135
      */
136 136
     private function sluggifyFilename($filename): string
137 137
     {
138
-        $extension = substr($filename, strrpos($filename, '.') + 1);
138
+        $extension = substr($filename, strrpos($filename, '.')+1);
139 139
         $filename  = substr($filename, 0, strrpos($filename, '.'));
140
-        $filename  = Str::slug($filename) . '.' . $extension;
140
+        $filename  = Str::slug($filename).'.'.$extension;
141 141
 
142 142
         return $filename;
143 143
     }
@@ -153,9 +153,9 @@  discard block
 block discarded – undo
153 153
                 if ($file instanceof UploadedFile && !$file->isValid()) {
154 154
                     if ($file->getError() == UPLOAD_ERR_INI_SIZE) {
155 155
                         throw new FileTooBigException(
156
-                            'Cannot upload file because it exceeded the allowed upload_max_filesize: upload_max_filesize is smaller than post size. ' .
157
-                            'upload_max_filesize: ' . (int)ini_get('upload_max_filesize') . 'MB, ' .
158
-                            'post_max_size: ' . (int)(ini_get('post_max_size')) . 'MB'
156
+                            'Cannot upload file because it exceeded the allowed upload_max_filesize: upload_max_filesize is smaller than post size. '.
157
+                            'upload_max_filesize: '.(int)ini_get('upload_max_filesize').'MB, '.
158
+                            'post_max_size: '.(int)(ini_get('post_max_size')).'MB'
159 159
                         );
160 160
                     }
161 161
                 }
@@ -169,16 +169,16 @@  discard block
 block discarded – undo
169 169
         foreach ($files_by_type as $type => $files) {
170 170
             foreach ($files as $locale => $_files) {
171 171
                 if (!in_array($locale, config('translatable.locales'))) {
172
-                    throw new \InvalidArgumentException('Corrupt file payload. key is expected to be a valid locale [' . implode(',', config('translatable.locales', [])). ']. Instead [' . $locale . '] is given.');
172
+                    throw new \InvalidArgumentException('Corrupt file payload. key is expected to be a valid locale ['.implode(',', config('translatable.locales', [])).']. Instead ['.$locale.'] is given.');
173 173
                 }
174 174
 
175 175
                 if (!is_array($_files)) {
176
-                    throw new \InvalidArgumentException('A valid files entry should be an array of files, key with either [new, replace or delete]. Instead a ' . gettype($_files) . ' is given.');
176
+                    throw new \InvalidArgumentException('A valid files entry should be an array of files, key with either [new, replace or delete]. Instead a '.gettype($_files).' is given.');
177 177
                 }
178 178
 
179 179
                 foreach ($_files as $action => $file) {
180 180
                     if (!in_array($action, $actions)) {
181
-                        throw new \InvalidArgumentException('A valid files entry should have a key of either ['.implode(',', $actions).']. Instead ' . $action . ' is given.');
181
+                        throw new \InvalidArgumentException('A valid files entry should have a key of either ['.implode(',', $actions).']. Instead '.$action.' is given.');
182 182
                     }
183 183
                 }
184 184
             }
Please login to merge, or discard this patch.