Passed
Push — dependabot/npm_and_yarn/axios-... ( 9e8317 )
by
unknown
09:46
created
src/Fields/Types/MediaField.php 1 patch
Spacing   +3 added lines, -3 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\Fields\Types;
6 6
 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
             return $this;
41 41
         }
42 42
 
43
-        return 'files['. ($this->values['name'] ?? $this->key()).']';
43
+        return 'files['.($this->values['name'] ?? $this->key()).']';
44 44
     }
45 45
 
46 46
     public function sluggifyName()
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
         $images = [];
59 59
         $locale = $locale ?? app()->getLocale();
60 60
 
61
-        $assets = $model->assetRelation->where('pivot.type', $this->key())->filter(function ($asset) use ($locale) {
61
+        $assets = $model->assetRelation->where('pivot.type', $this->key())->filter(function($asset) use ($locale) {
62 62
             return $asset->pivot->locale == $locale;
63 63
         })->sortBy('pivot.order');
64 64
 
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
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
         if (isset(json_decode($file)->output)) {
114 114
             $image_name = json_decode($file)->output->name;
115 115
             $asset      = app(AddAsset::class)->add($model, json_decode($file)->output->image, $type, $locale, $this->sluggifyFilename($image_name));
116
-        } else {
116
+        }else {
117 117
             if ($file instanceof UploadedFile) {
118 118
                 $image_name = $file->getClientOriginalName();
119 119
                 $asset      = app(AddAsset::class)->add($model, $file, $type, $locale, $this->sluggifyFilename($image_name));
@@ -121,16 +121,16 @@  discard block
 block discarded – undo
121 121
                 // New files are passed with their filename (instead of their id)
122 122
                 // For new files we will replace the filename with the id.
123 123
                 if (false !== ($key = array_search($image_name, $files_order))) {
124
-                    $files_order[$key] = (string) $asset->id;
124
+                    $files_order[$key] = (string)$asset->id;
125 125
                 }
126
-            } else {
127
-                $file   = Asset::find($file);
126
+            }else {
127
+                $file = Asset::find($file);
128 128
                 if ($file) {
129 129
                     if ($model->assetRelation()->where('asset_pivots.type', $type)->where('asset_pivots.locale', $locale)->get()->contains($file)) {
130 130
                         throw new DuplicateAssetException();
131 131
                     }
132 132
 
133
-                    $asset  = app(AddAsset::class)->add($model, $file, $type, $locale);
133
+                    $asset = app(AddAsset::class)->add($model, $file, $type, $locale);
134 134
                 }
135 135
             }
136 136
         }
@@ -142,9 +142,9 @@  discard block
 block discarded – undo
142 142
      */
143 143
     private function sluggifyFilename($filename): string
144 144
     {
145
-        $extension = substr($filename, strrpos($filename, '.') + 1);
145
+        $extension = substr($filename, strrpos($filename, '.')+1);
146 146
         $filename  = substr($filename, 0, strrpos($filename, '.'));
147
-        $filename  = Str::slug($filename) . '.' . $extension;
147
+        $filename  = Str::slug($filename).'.'.$extension;
148 148
 
149 149
         return $filename;
150 150
     }
@@ -160,9 +160,9 @@  discard block
 block discarded – undo
160 160
                 if ($file instanceof UploadedFile && !$file->isValid()) {
161 161
                     if ($file->getError() == UPLOAD_ERR_INI_SIZE) {
162 162
                         throw new FileTooBigException(
163
-                            'Cannot upload file because it exceeded the allowed upload_max_filesize: upload_max_filesize is smaller than post size. ' .
164
-                            'upload_max_filesize: ' . (int)ini_get('upload_max_filesize') . 'MB, ' .
165
-                            'post_max_size: ' . (int)(ini_get('post_max_size')) . 'MB'
163
+                            'Cannot upload file because it exceeded the allowed upload_max_filesize: upload_max_filesize is smaller than post size. '.
164
+                            'upload_max_filesize: '.(int)ini_get('upload_max_filesize').'MB, '.
165
+                            'post_max_size: '.(int)(ini_get('post_max_size')).'MB'
166 166
                         );
167 167
                     }
168 168
                 }
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
             foreach ($files as $locale => $_files) {
178 178
                 foreach ($_files as $action => $file) {
179 179
                     if (!in_array($action, $actions)) {
180
-                        throw new \InvalidArgumentException('A valid files entry should have a key of either ['.implode(',', $actions).']. Instead ' . $action . ' is given.');
180
+                        throw new \InvalidArgumentException('A valid files entry should have a key of either ['.implode(',', $actions).']. Instead '.$action.' is given.');
181 181
                     }
182 182
                 }
183 183
             }
Please login to merge, or discard this patch.