@@ -29,11 +29,9 @@ |
||
| 29 | 29 | |
| 30 | 30 | if ($this->shouldDeleteCover()) { |
| 31 | 31 | $output = DeleteCoverAction::make($this->data->type, $output)->run(); |
| 32 | - } |
|
| 33 | - else if ($this->shouldUploadCover()) { |
|
| 32 | + } else if ($this->shouldUploadCover()) { |
|
| 34 | 33 | $output = UploadCoverAction::make($this->cover, $this->data)->run($path); |
| 35 | - } |
|
| 36 | - else if ($this->data->generateCover) { |
|
| 34 | + } else if ($this->data->generateCover) { |
|
| 37 | 35 | $output = GenerateCoverFromFileAction::make($this->file, $this->data)->run($path); |
| 38 | 36 | } |
| 39 | 37 | |
@@ -37,8 +37,7 @@ discard block |
||
| 37 | 37 | // @codeCoverageIgnoreStart |
| 38 | 38 | if (ini_get('upload_tmp_dir')) { |
| 39 | 39 | $path = ini_get('upload_tmp_dir'); |
| 40 | - } |
|
| 41 | - else if (getenv('temp')) { |
|
| 40 | + } else if (getenv('temp')) { |
|
| 42 | 41 | $path = getenv('temp'); |
| 43 | 42 | } |
| 44 | 43 | // @codeCoverageIgnoreEnd |
@@ -81,8 +80,7 @@ discard block |
||
| 81 | 80 | |
| 82 | 81 | if (disk_driver_is_local($disk)) { |
| 83 | 82 | $temp = null; |
| 84 | - } |
|
| 85 | - else { |
|
| 83 | + } else { |
|
| 86 | 84 | $tempDir = larupload_temp_dir(); |
| 87 | 85 | $tempName = \Illuminate\Support\Carbon::now()->unix() . '-' . $name; |
| 88 | 86 | $temp = "$tempDir/$tempName"; |
@@ -135,8 +133,7 @@ discard block |
||
| 135 | 133 | } |
| 136 | 134 | |
| 137 | 135 | @rmdir($path); |
| 138 | - } |
|
| 139 | - else { |
|
| 136 | + } else { |
|
| 140 | 137 | $file = new \Symfony\Component\HttpFoundation\File\File($saveTo['temp']); |
| 141 | 138 | |
| 142 | 139 | \Illuminate\Support\Facades\Storage::disk($disk)->putFileAs( |
@@ -32,8 +32,7 @@ discard block |
||
| 32 | 32 | $table->string("{$name}_file_dominant_color", 7)->nullable(); |
| 33 | 33 | $table->string("{$name}_file_format", 85)->nullable(); |
| 34 | 34 | $table->string("{$name}_file_cover", 85)->nullable(); |
| 35 | - } |
|
| 36 | - else { |
|
| 35 | + } else { |
|
| 37 | 36 | $table->{self::jsonColumnType()}("{$name}_file_meta")->nullable(); |
| 38 | 37 | } |
| 39 | 38 | } |
@@ -65,8 +64,7 @@ discard block |
||
| 65 | 64 | $table->dropIndex("{$tableName}_{$name}_file_size_index"); |
| 66 | 65 | $table->dropIndex("{$tableName}_{$name}_file_type_index"); |
| 67 | 66 | $table->dropIndex("{$tableName}_{$name}_file_duration_index"); |
| 68 | - } |
|
| 69 | - else { |
|
| 67 | + } else { |
|
| 70 | 68 | $columns[] = "{$name}_file_meta"; |
| 71 | 69 | } |
| 72 | 70 | |
@@ -32,22 +32,19 @@ |
||
| 32 | 32 | 'Width is required when you are in SCALE_HEIGHT mode' |
| 33 | 33 | ); |
| 34 | 34 | } |
| 35 | - } |
|
| 36 | - else if ($this->mode === LaruploadMediaStyle::SCALE_WIDTH) { |
|
| 35 | + } else if ($this->mode === LaruploadMediaStyle::SCALE_WIDTH) { |
|
| 37 | 36 | if ($this->height === null or $this->height === 0) { |
| 38 | 37 | throw new Exception( |
| 39 | 38 | 'Height is required when you are in SCALE_WIDTH mode' |
| 40 | 39 | ); |
| 41 | 40 | } |
| 42 | - } |
|
| 43 | - else if (in_array($this->mode, [LaruploadMediaStyle::CROP, LaruploadMediaStyle::FIT])) { |
|
| 41 | + } else if (in_array($this->mode, [LaruploadMediaStyle::CROP, LaruploadMediaStyle::FIT])) { |
|
| 44 | 42 | if (!$this->width or !$this->height) { |
| 45 | 43 | throw new Exception( |
| 46 | 44 | 'Width and Height are required when you are in CROP/FIT mode' |
| 47 | 45 | ); |
| 48 | 46 | } |
| 49 | - } |
|
| 50 | - else if ($this->mode === LaruploadMediaStyle::AUTO) { |
|
| 47 | + } else if ($this->mode === LaruploadMediaStyle::AUTO) { |
|
| 51 | 48 | if (!$this->width and !$this->height) { |
| 52 | 49 | throw new Exception( |
| 53 | 50 | 'Width and height are required when you are in auto mode' |
@@ -42,14 +42,12 @@ discard block |
||
| 42 | 42 | $this->initializeFFMpegQueue( |
| 43 | 43 | $model->id, $model->getMorphClass(), $standalone |
| 44 | 44 | ); |
| 45 | - } |
|
| 46 | - else { |
|
| 45 | + } else { |
|
| 47 | 46 | $this->initializeFFMpegQueue( |
| 48 | 47 | $id, $model, $standalone |
| 49 | 48 | ); |
| 50 | 49 | } |
| 51 | - } |
|
| 52 | - else { |
|
| 50 | + } else { |
|
| 53 | 51 | $this->handleVideoStyles($id); |
| 54 | 52 | } |
| 55 | 53 | |
@@ -115,8 +113,7 @@ discard block |
||
| 115 | 113 | } |
| 116 | 114 | |
| 117 | 115 | return null; |
| 118 | - } |
|
| 119 | - else if ($name and $this->styleHasFile($style)) { |
|
| 116 | + } else if ($name and $this->styleHasFile($style)) { |
|
| 120 | 117 | $name = FixExceptionNamesAction::make($name, $style)->run(); |
| 121 | 118 | $path = $this->getBasePath($this->id, $style); |
| 122 | 119 | |
@@ -61,25 +61,20 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | if ($style->mode === LaruploadMediaStyle::SCALE_HEIGHT and $style->width) { |
| 63 | 63 | $this->resizeLandscape($style->width); |
| 64 | - } |
|
| 65 | - else if ($style->mode == LaruploadMediaStyle::SCALE_WIDTH and $style->height) { |
|
| 64 | + } else if ($style->mode == LaruploadMediaStyle::SCALE_WIDTH and $style->height) { |
|
| 66 | 65 | $this->resizePortrait($style->height); |
| 67 | - } |
|
| 68 | - else if ($style->mode == LaruploadMediaStyle::CROP and $style->height and $style->width) { |
|
| 66 | + } else if ($style->mode == LaruploadMediaStyle::CROP and $style->height and $style->width) { |
|
| 69 | 67 | $this->resizeCrop($style->width, $style->height); |
| 70 | - } |
|
| 71 | - else if ($style->mode == LaruploadMediaStyle::FIT and $style->height and $style->width) { |
|
| 68 | + } else if ($style->mode == LaruploadMediaStyle::FIT and $style->height and $style->width) { |
|
| 72 | 69 | $this->resizeExact($style->width, $style->height); |
| 73 | - } |
|
| 74 | - else { |
|
| 70 | + } else { |
|
| 75 | 71 | $this->resizeAuto($style->width, $style->height); |
| 76 | 72 | } |
| 77 | 73 | |
| 78 | 74 | |
| 79 | 75 | if ($this->driverIsLocal) { |
| 80 | 76 | $this->save($saveTo); |
| 81 | - } |
|
| 82 | - else { |
|
| 77 | + } else { |
|
| 83 | 78 | list($path, $name) = split_larupload_path($saveTo); |
| 84 | 79 | |
| 85 | 80 | $tempDir = larupload_temp_dir(); |
@@ -110,8 +105,7 @@ discard block |
||
| 110 | 105 | |
| 111 | 106 | if ($file instanceof UploadedFile) { |
| 112 | 107 | $path = $file->getRealPath(); |
| 113 | - } |
|
| 114 | - else if (file_exists($file)) { |
|
| 108 | + } else if (file_exists($file)) { |
|
| 115 | 109 | $path = $file; |
| 116 | 110 | } |
| 117 | 111 | |
@@ -66,8 +66,7 @@ |
||
| 66 | 66 | |
| 67 | 67 | $model->{"{$this->name}_file_$key"} = $value; |
| 68 | 68 | } |
| 69 | - } |
|
| 70 | - else { |
|
| 69 | + } else { |
|
| 71 | 70 | $model->{"{$this->name}_file_name"} = $this->output['name'] ?? null; |
| 72 | 71 | $model->{"{$this->name}_file_meta"} = json_encode($this->output); |
| 73 | 72 | } |
@@ -55,8 +55,7 @@ discard block |
||
| 55 | 55 | isLastOne: $this->availableQueues() === 1, |
| 56 | 56 | standalone: true |
| 57 | 57 | ); |
| 58 | - } |
|
| 59 | - else { |
|
| 58 | + } else { |
|
| 60 | 59 | /** @var Model $class */ |
| 61 | 60 | $class = class_exists($this->model) ? $this->model : Relation::getMorphedModel($this->model); |
| 62 | 61 | $modelNotSaved = true; |
@@ -75,8 +74,7 @@ discard block |
||
| 75 | 74 | } |
| 76 | 75 | |
| 77 | 76 | $this->updateStatus(true, false); |
| 78 | - } |
|
| 79 | - catch (FileNotFoundException | Exception $e) { |
|
| 77 | + } catch (FileNotFoundException | Exception $e) { |
|
| 80 | 78 | $this->updateStatus(false, false, $e->getMessage()); |
| 81 | 79 | |
| 82 | 80 | throw new Exception($e->getMessage()); |