Completed
Pull Request — master (#264)
by Philippe
129:28 queued 70:58
created
src/PageBuilder/UpdateSections.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
     private function removeExistingSets()
91 91
     {
92 92
         foreach ($this->model->children() as $instance) {
93
-            if (! $instance instanceof StoredSetReference) {
93
+            if (!$instance instanceof StoredSetReference) {
94 94
                 continue;
95 95
             }
96 96
             $this->model->rejectChild($instance);
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
         }
145 145
 
146 146
         foreach ($this->text_modules['replace'] as $text_module) {
147
-            if (! $module = FlatReferenceFactory::fromString($text_module['id'])->instance()) {
147
+            if (!$module = FlatReferenceFactory::fromString($text_module['id'])->instance()) {
148 148
                 continue;
149 149
             }
150 150
 
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 
164 164
     private function removeTextualModule($module)
165 165
     {
166
-        if (! $module instanceof TextModule && ! $module instanceof PagetitleModule) {
166
+        if (!$module instanceof TextModule && !$module instanceof PagetitleModule) {
167 167
             throw new \Exception('Invalid request to remove non textual module');
168 168
         }
169 169
 
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
                 continue;
186 186
             }
187 187
 
188
-            $child = $children->first(function ($c) use ($reference) {
188
+            $child = $children->first(function($c) use ($reference) {
189 189
                 return $c->flatReference()->get() == $reference;
190 190
             });
191 191
 
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
     private function stripTagsBlacklist($value, $blacklist = [])
237 237
     {
238 238
         foreach ($blacklist as $tag) {
239
-            $value = preg_replace('/<\/?' . $tag . '(.|\s)*?>/', '', $value);
239
+            $value = preg_replace('/<\/?'.$tag.'(.|\s)*?>/', '', $value);
240 240
         }
241 241
 
242 242
         return $value;
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
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
         if (is_string($file)) {
53 53
             $image_name = json_decode($file)->output->name;
54 54
             $asset      = $this->addAsset(json_decode($file)->output->image, $type, $locale, $image_name, $model);
55
-        } else {
55
+        }else {
56 56
             $image_name = $file->getClientOriginalName();
57 57
             $asset      = $this->addAsset($file, $type, $locale, $image_name, $model);
58 58
         }
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 
76 76
         if (is_string($file)) {
77 77
             $asset = AssetUploader::uploadFromBase64($file, $filename);
78
-        } else {
78
+        }else {
79 79
             $asset = AssetUploader::upload($file, $filename);
80 80
         }
81 81
 
@@ -139,9 +139,9 @@  discard block
 block discarded – undo
139 139
      */
140 140
     private function sluggifyFilename($filename): string
141 141
     {
142
-        $extension = substr($filename, strrpos($filename, '.') + 1);
142
+        $extension = substr($filename, strrpos($filename, '.')+1);
143 143
         $filename  = substr($filename, 0, strrpos($filename, '.'));
144
-        $filename  = str_slug($filename) . '.' . $extension;
144
+        $filename  = str_slug($filename).'.'.$extension;
145 145
 
146 146
         return $filename;
147 147
     }
@@ -157,9 +157,9 @@  discard block
 block discarded – undo
157 157
                 if ($file instanceof UploadedFile && !$file->isValid()) {
158 158
                     if ($file->getError() == UPLOAD_ERR_INI_SIZE) {
159 159
                         throw new FileTooBigException(
160
-                            'Cannot upload file because it exceeded the allowed upload_max_filesize: upload_max_filesize is smaller than post size. ' .
161
-                            'upload_max_filesize: ' . (int)ini_get('upload_max_filesize') . 'MB, ' .
162
-                            'post_max_size: ' . (int)(ini_get('post_max_size')) . 'MB'
160
+                            'Cannot upload file because it exceeded the allowed upload_max_filesize: upload_max_filesize is smaller than post size. '.
161
+                            'upload_max_filesize: '.(int)ini_get('upload_max_filesize').'MB, '.
162
+                            'post_max_size: '.(int)(ini_get('post_max_size')).'MB'
163 163
                         );
164 164
                     }
165 165
                 }
@@ -174,16 +174,16 @@  discard block
 block discarded – undo
174 174
         foreach ($files_by_type as $type => $files) {
175 175
             foreach ($files as $locale => $_files) {
176 176
                 if (!in_array($locale, config('translatable.locales'))) {
177
-                    throw new \InvalidArgumentException('Corrupt file payload. key is expected to be a valid locale [' . implode(',', config('translatable.locales', [])). ']. Instead [' . $locale . '] is given.');
177
+                    throw new \InvalidArgumentException('Corrupt file payload. key is expected to be a valid locale ['.implode(',', config('translatable.locales', [])).']. Instead ['.$locale.'] is given.');
178 178
                 }
179 179
 
180 180
                 if (!is_array($_files)) {
181
-                    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.');
181
+                    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.');
182 182
                 }
183 183
 
184 184
                 foreach ($_files as $action => $file) {
185 185
                     if (!in_array($action, $actions)) {
186
-                        throw new \InvalidArgumentException('A valid files entry should have a key of either ['.implode(',', $actions).']. Instead ' . $action . ' is given.');
186
+                        throw new \InvalidArgumentException('A valid files entry should have a key of either ['.implode(',', $actions).']. Instead '.$action.' is given.');
187 187
                     }
188 188
                 }
189 189
             }
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
         foreach ($files_order_by_type as $type => $fileIdsCollection) {
193 193
             foreach ($fileIdsCollection as $locale => $commaSeparatedFileIds) {
194 194
                 if (!in_array($locale, config('translatable.locales'))) {
195
-                    throw new \InvalidArgumentException('Corrupt file payload. key for the file order is expected to be a valid locale [' . implode(',', config('translatable.locales', [])). ']. Instead [' . $locale . '] is given.');
195
+                    throw new \InvalidArgumentException('Corrupt file payload. key for the file order is expected to be a valid locale ['.implode(',', config('translatable.locales', [])).']. Instead ['.$locale.'] is given.');
196 196
                 }
197 197
             }
198 198
         }
Please login to merge, or discard this patch.
src/HealthMonitor/Monitor.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\HealthMonitor;
6 6
 
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
             if (!$checkInstance->check()) {
24 24
                 app($notifier)->onFailure($checkInstance);
25 25
                 return;
26
-            } else {
26
+            }else {
27 27
                 app($notifier)->onSuccess($checkInstance);
28 28
             }
29 29
         }
Please login to merge, or discard this patch.
src/HealthMonitor/Checks/HomepageAccessibleCheck.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\HealthMonitor\Checks;
6 6
 
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 
16 16
     private function get_http_response_code(string $url)
17 17
     {
18
-        if ($url =='') {
18
+        if ($url == '') {
19 19
             return false;
20 20
         }
21 21
 
@@ -33,6 +33,6 @@  discard block
 block discarded – undo
33 33
 
34 34
     public function message(): string
35 35
     {
36
-        return 'Het lijkt erop dat de homepagina niet meer bereikbaar is. <a href="'. route('chief.back.settings.edit') .'" class="text-secondary-800 underline hover:text-white">Kies een nieuwe</a>.';
36
+        return 'Het lijkt erop dat de homepagina niet meer bereikbaar is. <a href="'.route('chief.back.settings.edit').'" class="text-secondary-800 underline hover:text-white">Kies een nieuwe</a>.';
37 37
     }
38 38
 }
Please login to merge, or discard this patch.
src/Common/helpers.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
         $empty = true;
75 75
 
76 76
         foreach ($values as $value) {
77
-            if (! $value || !trim($value)) {
77
+            if (!$value || !trim($value)) {
78 78
                 continue;
79 79
             }
80 80
             $empty = false;
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
     }
85 85
 }
86 86
 
87
-if (! function_exists('contract')) {
87
+if (!function_exists('contract')) {
88 88
     function contract($instance, $contract)
89 89
     {
90 90
         return $instance instanceof $contract;
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
             $text = cleanupHTML($text, $clean);
114 114
         }
115 115
         $teaser = substr($text, 0, $max);
116
-        return strlen($text) <= $max ? $teaser : $teaser . $ending;
116
+        return strlen($text) <= $max ? $teaser : $teaser.$ending;
117 117
     }
118 118
 }
119 119
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
          * htmlPurifier converts characters to their encode equivalents. This is something
172 172
          * that we need to reverse after the htmlPurifier cleanup.
173 173
          */
174
-        $value  = str_replace('&amp;', '&', $value);
174
+        $value = str_replace('&amp;', '&', $value);
175 175
 
176 176
         return $value;
177 177
     }
@@ -239,16 +239,16 @@  discard block
 block discarded – undo
239 239
             'scheme', 'host', 'port', 'path', 'query', 'fragment'
240 240
         ], null), $parsed_url, $overrides);
241 241
 
242
-        $scheme = $parsed_url['scheme'] ? $parsed_url['scheme'] . '://' : null;
243
-        $port = $parsed_url['port'] ? ':' . $parsed_url['port'] : null;
244
-        $fragment = $parsed_url['fragment'] ? '#' . $parsed_url['fragment'] : null;
242
+        $scheme = $parsed_url['scheme'] ? $parsed_url['scheme'].'://' : null;
243
+        $port = $parsed_url['port'] ? ':'.$parsed_url['port'] : null;
244
+        $fragment = $parsed_url['fragment'] ? '#'.$parsed_url['fragment'] : null;
245 245
 
246
-        $baseurl = $scheme . $parsed_url['host'] . $port . $parsed_url['path'];
246
+        $baseurl = $scheme.$parsed_url['host'].$port.$parsed_url['path'];
247 247
         $current_query = [];
248 248
 
249 249
         $_query = explode('&', $parsed_url['query']);
250 250
 
251
-        array_map(function ($v) use (&$current_query) {
251
+        array_map(function($v) use (&$current_query) {
252 252
             if (!$v) {
253 253
                 return;
254 254
             }
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 
267 267
         $query = urldecode(http_build_query(array_merge($current_query, $query_params)));
268 268
 
269
-        return $baseurl . '?' . $query . $fragment;
269
+        return $baseurl.'?'.$query.$fragment;
270 270
     }
271 271
 }
272 272
 
@@ -275,9 +275,9 @@  discard block
 block discarded – undo
275 275
     {
276 276
         $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
277 277
         if (php_sapi_name() == 'cli') {
278
-            print_r("\e[1;30m dumped at: " . str_replace(base_path(), '', $trace[0]['file']). ", line: " . $trace[0]['line'] . "\e[40m\n");
279
-        } else {
280
-            print_r("[dumped at: " . str_replace(base_path(), '', $trace[0]['file']). ", line: " . $trace[0]['line'] . "]\n");
278
+            print_r("\e[1;30m dumped at: ".str_replace(base_path(), '', $trace[0]['file']).", line: ".$trace[0]['line']."\e[40m\n");
279
+        }else {
280
+            print_r("[dumped at: ".str_replace(base_path(), '', $trace[0]['file']).", line: ".$trace[0]['line']."]\n");
281 281
         }
282 282
         return dd($var, ...$moreVars);
283 283
     }
Please login to merge, or discard this patch.
src/Fields/Types/Field.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
 
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 
67 67
     public function optional(): bool
68 68
     {
69
-        return ! $this->required();
69
+        return !$this->required();
70 70
     }
71 71
 
72 72
     public function name(string $name = null)
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
         }
196 196
 
197 197
         if (!in_array($name, ['label', 'key', 'description', 'column', 'name', 'prepend', 'append'])) {
198
-            throw new \InvalidArgumentException('Cannot set value by ['. $name .'].');
198
+            throw new \InvalidArgumentException('Cannot set value by ['.$name.'].');
199 199
         }
200 200
 
201 201
         $this->values[$name] = $arguments[0];
Please login to merge, or discard this patch.