Test Failed
Push — ft/generate-page-command ( d3f4ee )
by Philippe
17:08
created
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.
src/Pages/Console/GeneratePage.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -31,8 +31,8 @@  discard block
 block discarded – undo
31 31
 
32 32
         // Set required paths
33 33
         $this->dirs = ['base' => $this->settings['base_path'] ?? base_path()];
34
-        $this->dirs['model'] = $this->settings['model_path'] ?? $this->dirs['base'] .'/'. config('thinktomorrow.chief.domain.path', 'src');
35
-        $this->dirs['views'] = $this->settings['views_path'] ?? $this->dirs['base'] . '/resources/views';
34
+        $this->dirs['model'] = $this->settings['model_path'] ?? $this->dirs['base'].'/'.config('thinktomorrow.chief.domain.path', 'src');
35
+        $this->dirs['views'] = $this->settings['views_path'] ?? $this->dirs['base'].'/resources/views';
36 36
     }
37 37
 
38 38
     public function handle()
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
     private function publishModel()
50 50
     {
51 51
         $this->publishFile(
52
-            __DIR__ . '/stubs/model.php.stub',
53
-            $to = $this->dirs['model'] . '/' . ucfirst($this->plural) . '/' . ucfirst($this->singular) . '.php',
52
+            __DIR__.'/stubs/model.php.stub',
53
+            $to = $this->dirs['model'].'/'.ucfirst($this->plural).'/'.ucfirst($this->singular).'.php',
54 54
             'model'
55 55
         );
56 56
 
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
     private function publishController()
61 61
     {
62 62
         $this->publishFile(
63
-            __DIR__ . '/stubs/controller.php.stub',
64
-            $to = $this->dirs['controller'] . '/' . ucfirst($this->plural) . '/' . ucfirst($this->singular) . '.php',
63
+            __DIR__.'/stubs/controller.php.stub',
64
+            $to = $this->dirs['controller'].'/'.ucfirst($this->plural).'/'.ucfirst($this->singular).'.php',
65 65
             'controller'
66 66
         );
67 67
     }
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
     protected function publishFile($from, $to, $type)
77 77
     {
78 78
         if ($this->filesystem->exists($to) && !$this->option('force')) {
79
-            if (!$this->confirm('File [' . $to . '] already exists? Overwrite this file?')) {
79
+            if (!$this->confirm('File ['.$to.'] already exists? Overwrite this file?')) {
80 80
                 return;
81 81
             }
82 82
         }
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 
116 116
         $to = str_replace($this->dirs['base'], '', realpath($to));
117 117
 
118
-        $this->line('<info>Copied ' . $type . '</info> <comment>[' . $from . ']</comment> <info>To</info> <comment>[' . $to . ']</comment>');
118
+        $this->line('<info>Copied '.$type.'</info> <comment>['.$from.']</comment> <info>To</info> <comment>['.$to.']</comment>');
119 119
     }
120 120
 
121 121
     protected function replacePlaceholders($content)
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 
140 140
         // We make an estimated guess based on the project name. At Think Tomorrow, we
141 141
         // have a src folder which is PSR-4 namespaced by the project name itself.
142
-        return str_replace('\\\\', '\\', ucfirst(config('thinktomorrow.chief.domain.namespace', 'App')).'\\'. ucfirst($this->plural));
142
+        return str_replace('\\\\', '\\', ucfirst(config('thinktomorrow.chief.domain.namespace', 'App')).'\\'.ucfirst($this->plural));
143 143
     }
144 144
 
145 145
     private function addToConfig($configKey, $value)
@@ -157,12 +157,12 @@  discard block
 block discarded – undo
157 157
     {
158 158
         $content = file_get_contents($file);
159 159
 
160
-        if(strpos($key,'.') !== false)
160
+        if (strpos($key, '.') !== false)
161 161
         {
162 162
             $key = explode('.', $key);
163 163
 
164 164
             $content = preg_replace('/([\'|"]'.$key[0].'[\'|"][ ]*=>[ ]*\[[^\]]*\][ |,|\n]*[\'|"]'.$key[1].'[\'|"][ ]*=>[ ]*\[)([^\]]*|.*[\'|"])/', "$1".$value[0], $content);
165
-        }else{
165
+        }else {
166 166
             $content = preg_replace('/[\'|"]'.$key.'[\'|"] ?=> ?(\[[^\]]*\]|[\'|"].*[\'|"])/', var_export($value, true), $content);
167 167
         }
168 168
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -162,7 +162,7 @@
 block discarded – undo
162 162
             $key = explode('.', $key);
163 163
 
164 164
             $content = preg_replace('/([\'|"]'.$key[0].'[\'|"][ ]*=>[ ]*\[[^\]]*\][ |,|\n]*[\'|"]'.$key[1].'[\'|"][ ]*=>[ ]*\[)([^\]]*|.*[\'|"])/', "$1".$value[0], $content);
165
-        }else{
165
+        } else{
166 166
             $content = preg_replace('/[\'|"]'.$key.'[\'|"] ?=> ?(\[[^\]]*\]|[\'|"].*[\'|"])/', var_export($value, true), $content);
167 167
         }
168 168
 
Please login to merge, or discard this patch.