@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | private function removeExistingSets() |
92 | 92 | { |
93 | 93 | foreach ($this->model->children() as $instance) { |
94 | - if (! $instance instanceof StoredSetReference) { |
|
94 | + if (!$instance instanceof StoredSetReference) { |
|
95 | 95 | continue; |
96 | 96 | } |
97 | 97 | $this->model->rejectChild($instance); |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | } |
146 | 146 | |
147 | 147 | foreach ($this->text_modules['replace'] as $text_module) { |
148 | - if (! $module = FlatReferenceFactory::fromString($text_module['id'])->instance()) { |
|
148 | + if (!$module = FlatReferenceFactory::fromString($text_module['id'])->instance()) { |
|
149 | 149 | continue; |
150 | 150 | } |
151 | 151 | // Do not update if content of text is completely empty. We will remove this module instead |
@@ -154,10 +154,10 @@ discard block |
||
154 | 154 | continue; |
155 | 155 | } |
156 | 156 | |
157 | - foreach($text_module['trans'] as $locale => $content) |
|
157 | + foreach ($text_module['trans'] as $locale => $content) |
|
158 | 158 | { |
159 | 159 | $purifier = new HTMLPurifier(); |
160 | - $sanitized_text = $purifier->purify( $content['content'] ); |
|
160 | + $sanitized_text = $purifier->purify($content['content']); |
|
161 | 161 | |
162 | 162 | $text_module['trans'][$locale]['content'] = $sanitized_text; |
163 | 163 | } |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | |
172 | 172 | private function removeTextualModule($module) |
173 | 173 | { |
174 | - if (! $module instanceof TextModule && ! $module instanceof PagetitleModule) { |
|
174 | + if (!$module instanceof TextModule && !$module instanceof PagetitleModule) { |
|
175 | 175 | throw new \Exception('Invalid request to remove non textual module'); |
176 | 176 | } |
177 | 177 | |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | continue; |
194 | 194 | } |
195 | 195 | |
196 | - $child = $children->first(function ($c) use ($reference) { |
|
196 | + $child = $children->first(function($c) use ($reference) { |
|
197 | 197 | return $c->flatReference()->get() == $reference; |
198 | 198 | }); |
199 | 199 | |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | private function stripTagsBlacklist($value, $blacklist = []) |
245 | 245 | { |
246 | 246 | foreach ($blacklist as $tag) { |
247 | - $value = preg_replace('/<\/?' . $tag . '(.|\s)*?>/', '', $value); |
|
247 | + $value = preg_replace('/<\/?'.$tag.'(.|\s)*?>/', '', $value); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | return $value; |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | private function addFiles(HasMedia $model, string $type, array $files, array &$files_order, string $locale = null) |
52 | 52 | { |
53 | - if(!$this->actionExists($files, 'new')) return; |
|
53 | + if (!$this->actionExists($files, 'new')) return; |
|
54 | 54 | |
55 | 55 | foreach ($files['new'] as $id => $file) { |
56 | 56 | if (!$file) { |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | */ |
69 | 69 | private function replaceFiles(HasMedia $model, array $files) |
70 | 70 | { |
71 | - if(!$this->actionExists($files, 'replace')) return; |
|
71 | + if (!$this->actionExists($files, 'replace')) return; |
|
72 | 72 | |
73 | 73 | foreach ($files['replace'] as $id => $file) { |
74 | 74 | if (!$file) { |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | */ |
87 | 87 | private function removeFiles(HasMedia $model, array $files) |
88 | 88 | { |
89 | - if(!$this->actionExists($files, 'delete')) return; |
|
89 | + if (!$this->actionExists($files, 'delete')) return; |
|
90 | 90 | |
91 | 91 | foreach ($model->assets()->whereIn('id', $files['delete'])->get() as $asset) { |
92 | 92 | $asset->delete(); |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | if (is_string($file)) { |
104 | 104 | $image_name = json_decode($file)->name; |
105 | 105 | $asset = $this->addAsset(json_decode($file)->data, $type, $locale, $image_name, $model); |
106 | - } else { |
|
106 | + }else { |
|
107 | 107 | $image_name = $file->getClientOriginalName(); |
108 | 108 | $asset = $this->addAsset($file, $type, $locale, $image_name, $model); |
109 | 109 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | |
127 | 127 | if (is_string($file)) { |
128 | 128 | $asset = AssetUploader::uploadFromBase64($file, $filename); |
129 | - } else { |
|
129 | + }else { |
|
130 | 130 | $asset = AssetUploader::upload($file, $filename); |
131 | 131 | } |
132 | 132 | |
@@ -143,9 +143,9 @@ discard block |
||
143 | 143 | */ |
144 | 144 | private function sluggifyFilename($filename): string |
145 | 145 | { |
146 | - $extension = substr($filename, strrpos($filename, '.') + 1); |
|
146 | + $extension = substr($filename, strrpos($filename, '.')+1); |
|
147 | 147 | $filename = substr($filename, 0, strrpos($filename, '.')); |
148 | - $filename = str_slug($filename) . '.' . $extension; |
|
148 | + $filename = str_slug($filename).'.'.$extension; |
|
149 | 149 | |
150 | 150 | return $filename; |
151 | 151 | } |
@@ -161,9 +161,9 @@ discard block |
||
161 | 161 | if ($file instanceof UploadedFile && !$file->isValid()) { |
162 | 162 | if ($file->getError() == UPLOAD_ERR_INI_SIZE) { |
163 | 163 | throw new FileTooBigException( |
164 | - 'Cannot upload file because it exceeded the allowed upload_max_filesize: upload_max_filesize is smaller than post size. ' . |
|
165 | - 'upload_max_filesize: ' . (int)ini_get('upload_max_filesize') . 'MB, ' . |
|
166 | - 'post_max_size: ' . (int)(ini_get('post_max_size')) . 'MB' |
|
164 | + 'Cannot upload file because it exceeded the allowed upload_max_filesize: upload_max_filesize is smaller than post size. '. |
|
165 | + 'upload_max_filesize: '.(int)ini_get('upload_max_filesize').'MB, '. |
|
166 | + 'post_max_size: '.(int)(ini_get('post_max_size')).'MB' |
|
167 | 167 | ); |
168 | 168 | } |
169 | 169 | } |
@@ -178,16 +178,16 @@ discard block |
||
178 | 178 | foreach ($files_by_type as $type => $files) { |
179 | 179 | foreach ($files as $locale => $_files) { |
180 | 180 | if (!in_array($locale, config('translatable.locales'))) { |
181 | - throw new \InvalidArgumentException('Corrupt file payload. key is expected to be a valid locale [' . implode(',', config('translatable.locales', [])). ']. Instead [' . $locale . '] is given.'); |
|
181 | + throw new \InvalidArgumentException('Corrupt file payload. key is expected to be a valid locale ['.implode(',', config('translatable.locales', [])).']. Instead ['.$locale.'] is given.'); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | if (!is_array($_files)) { |
185 | - 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.'); |
|
185 | + 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.'); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | foreach ($_files as $action => $file) { |
189 | 189 | if (!in_array($action, $actions)) { |
190 | - throw new \InvalidArgumentException('A valid files entry should have a key of either ['.implode(',', $actions).']. Instead ' . $action . ' is given.'); |
|
190 | + throw new \InvalidArgumentException('A valid files entry should have a key of either ['.implode(',', $actions).']. Instead '.$action.' is given.'); |
|
191 | 191 | } |
192 | 192 | } |
193 | 193 | } |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | foreach ($files_order_by_type as $type => $fileIdsCollection) { |
197 | 197 | foreach ($fileIdsCollection as $locale => $commaSeparatedFileIds) { |
198 | 198 | if (!in_array($locale, config('translatable.locales'))) { |
199 | - 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.'); |
|
199 | + 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.'); |
|
200 | 200 | } |
201 | 201 | } |
202 | 202 | } |