@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types = 1); |
|
| 2 | +declare(strict_types=1); |
|
| 3 | 3 | |
| 4 | 4 | namespace Thinktomorrow\Chief\Fields\Types; |
| 5 | 5 | |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types = 1); |
|
| 2 | +declare(strict_types=1); |
|
| 3 | 3 | |
| 4 | 4 | namespace Thinktomorrow\Chief\Fields\Types; |
| 5 | 5 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | return static::$managedModelKey; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - throw new \Exception('Missing required static property \'managedModelKey\' on ' . static::class. '.'); |
|
| 87 | + throw new \Exception('Missing required static property \'managedModelKey\' on '.static::class.'.'); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | /** |
@@ -124,9 +124,9 @@ discard block |
||
| 124 | 124 | public function flatReferenceLabel(): string |
| 125 | 125 | { |
| 126 | 126 | if ($this->exists) { |
| 127 | - $status = ! $this->isPublished() ? ' [' . $this->statusAsPlainLabel().']' : null; |
|
| 127 | + $status = !$this->isPublished() ? ' ['.$this->statusAsPlainLabel().']' : null; |
|
| 128 | 128 | |
| 129 | - return $this->title ? $this->title . $status : ''; |
|
| 129 | + return $this->title ? $this->title.$status : ''; |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | return ''; |
@@ -52,7 +52,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |