@@ -10,10 +10,10 @@ discard block |
||
10 | 10 | |
11 | 11 | class AudioStyle extends Style |
12 | 12 | { |
13 | - public readonly Mp3|Aac|Wav|Flac $format; |
|
13 | + public readonly Mp3 | Aac | Wav | Flac $format; |
|
14 | 14 | |
15 | 15 | |
16 | - public function __construct(string $name, Mp3|Aac|Wav|Flac $format = new Mp3) |
|
16 | + public function __construct(string $name, Mp3 | Aac | Wav | Flac $format = new Mp3) |
|
17 | 17 | { |
18 | 18 | parent::__construct($name); |
19 | 19 | |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | |
22 | 22 | } |
23 | 23 | |
24 | - public static function make(string $name, Mp3|Aac|Wav|Flac $format = new Mp3): self |
|
24 | + public static function make(string $name, Mp3 | Aac | Wav | Flac $format = new Mp3): self |
|
25 | 25 | { |
26 | 26 | return new self($name, $format); |
27 | 27 | } |
@@ -30,11 +30,9 @@ |
||
30 | 30 | { |
31 | 31 | if ($this->format instanceof Aac) { |
32 | 32 | return 'aac'; |
33 | - } |
|
34 | - else if ($this->format instanceof Wav) { |
|
33 | + } else if ($this->format instanceof Wav) { |
|
35 | 34 | return 'wav'; |
36 | - } |
|
37 | - else if ($this->format instanceof Flac) { |
|
35 | + } else if ($this->format instanceof Flac) { |
|
38 | 36 | return 'flac'; |
39 | 37 | } |
40 | 38 |
@@ -25,8 +25,7 @@ discard block |
||
25 | 25 | |
26 | 26 | if ($this->type == LaruploadFileType::VIDEO) { |
27 | 27 | $this->handleVideoStyles($this->id); |
28 | - } |
|
29 | - else if ($this->type == LaruploadFileType::AUDIO) { |
|
28 | + } else if ($this->type == LaruploadFileType::AUDIO) { |
|
30 | 29 | $this->handleAudioStyles($this->id); |
31 | 30 | } |
32 | 31 | |
@@ -44,8 +43,7 @@ discard block |
||
44 | 43 | |
45 | 44 | if ($maxQueueNum == 0) { |
46 | 45 | $flag = true; |
47 | - } |
|
48 | - else { |
|
46 | + } else { |
|
49 | 47 | $availableQueues = DB::table(Larupload::FFMPEG_QUEUE_TABLE) |
50 | 48 | ->where('status', 0) |
51 | 49 | ->count(); |
@@ -82,8 +80,7 @@ discard block |
||
82 | 80 | |
83 | 81 | |
84 | 82 | ProcessFFMpeg::dispatch($queueId, $id, $this->name, $class, $serializedClass); |
85 | - } |
|
86 | - else { |
|
83 | + } else { |
|
87 | 84 | throw new HttpResponseException(redirect(URL::previous())->withErrors([ |
88 | 85 | 'ffmpeg_queue_max_num' => trans('larupload::messages.max-queue-num-exceeded') |
89 | 86 | ])); |
@@ -29,7 +29,7 @@ |
||
29 | 29 | protected int $ffmpegMaxQueueNum; |
30 | 30 | |
31 | 31 | |
32 | - protected function ffmpeg(UploadedFile $file = null, AudioStyle|VideoStyle|null $style = null): FFMpeg |
|
32 | + protected function ffmpeg(UploadedFile $file = null, AudioStyle | VideoStyle | null $style = null): FFMpeg |
|
33 | 33 | { |
34 | 34 | $force = false; |
35 | 35 |
@@ -80,14 +80,14 @@ |
||
80 | 80 | return $this; |
81 | 81 | } |
82 | 82 | |
83 | - public function video(string $name, ?int $width = null, ?int $height = null, LaruploadMediaStyle $mode = LaruploadMediaStyle::SCALE_HEIGHT, X264|WebM|Ogg|Mp3|Aac|Wav|Flac $format = new X264, bool $padding = false): UploadEntities |
|
83 | + public function video(string $name, ?int $width = null, ?int $height = null, LaruploadMediaStyle $mode = LaruploadMediaStyle::SCALE_HEIGHT, X264 | WebM | Ogg | Mp3 | Aac | Wav | Flac $format = new X264, bool $padding = false): UploadEntities |
|
84 | 84 | { |
85 | 85 | $this->videoStyles[$name] = VideoStyle::make($name, $width, $height, $mode, $format, $padding); |
86 | 86 | |
87 | 87 | return $this; |
88 | 88 | } |
89 | 89 | |
90 | - public function audio(string $name, Mp3|Aac|Wav|Flac $format = new Mp3): UploadEntities |
|
90 | + public function audio(string $name, Mp3 | Aac | Wav | Flac $format = new Mp3): UploadEntities |
|
91 | 91 | { |
92 | 92 | $this->audioStyles[$name] = AudioStyle::make($name, $format); |
93 | 93 |
@@ -16,9 +16,9 @@ discard block |
||
16 | 16 | class VideoStyle extends Style |
17 | 17 | { |
18 | 18 | public readonly LaruploadMediaStyle $mode; |
19 | - public readonly X264|WebM|Ogg|Mp3|Aac|Wav|Flac $format; |
|
19 | + public readonly X264 | WebM | Ogg | Mp3 | Aac | Wav | Flac $format; |
|
20 | 20 | |
21 | - public function __construct(string $name, ?int $width = null, ?int $height = null, LaruploadMediaStyle $mode = LaruploadMediaStyle::SCALE_HEIGHT, X264|WebM|Ogg|Mp3|Aac|Wav|Flac $format = new X264, bool $padding = false) |
|
21 | + public function __construct(string $name, ?int $width = null, ?int $height = null, LaruploadMediaStyle $mode = LaruploadMediaStyle::SCALE_HEIGHT, X264 | WebM | Ogg | Mp3 | Aac | Wav | Flac $format = new X264, bool $padding = false) |
|
22 | 22 | { |
23 | 23 | parent::__construct($name, $width, $height, $padding); |
24 | 24 | |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | $this->validateDimension(); |
29 | 29 | } |
30 | 30 | |
31 | - public static function make(string $name, ?int $width = null, ?int $height = null, LaruploadMediaStyle $mode = LaruploadMediaStyle::SCALE_HEIGHT, X264|WebM|Ogg|Mp3|Aac|Wav|Flac $format = new X264, bool $padding = false): self |
|
31 | + public static function make(string $name, ?int $width = null, ?int $height = null, LaruploadMediaStyle $mode = LaruploadMediaStyle::SCALE_HEIGHT, X264 | WebM | Ogg | Mp3 | Aac | Wav | Flac $format = new X264, bool $padding = false): self |
|
32 | 32 | { |
33 | 33 | return new self($name, $width, $height, $mode, $format, $padding); |
34 | 34 | } |
@@ -50,20 +50,15 @@ discard block |
||
50 | 50 | { |
51 | 51 | if ($this->format instanceof WebM) { |
52 | 52 | return 'webm'; |
53 | - } |
|
54 | - else if ($this->format instanceof Ogg) { |
|
53 | + } else if ($this->format instanceof Ogg) { |
|
55 | 54 | return 'ogg'; |
56 | - } |
|
57 | - else if ($this->format instanceof Mp3) { |
|
55 | + } else if ($this->format instanceof Mp3) { |
|
58 | 56 | return 'mp3'; |
59 | - } |
|
60 | - else if ($this->format instanceof Aac) { |
|
57 | + } else if ($this->format instanceof Aac) { |
|
61 | 58 | return 'aac'; |
62 | - } |
|
63 | - else if ($this->format instanceof Wav) { |
|
59 | + } else if ($this->format instanceof Wav) { |
|
64 | 60 | return 'wav'; |
65 | - } |
|
66 | - else if ($this->format instanceof Flac) { |
|
61 | + } else if ($this->format instanceof Flac) { |
|
67 | 62 | return 'flac'; |
68 | 63 | } |
69 | 64 | |
@@ -82,22 +77,19 @@ discard block |
||
82 | 77 | 'Width is required when you are in SCALE_HEIGHT mode' |
83 | 78 | ); |
84 | 79 | } |
85 | - } |
|
86 | - else if ($this->mode === LaruploadMediaStyle::SCALE_WIDTH) { |
|
80 | + } else if ($this->mode === LaruploadMediaStyle::SCALE_WIDTH) { |
|
87 | 81 | if ($this->height === null or $this->height === 0) { |
88 | 82 | throw new Exception( |
89 | 83 | 'Height is required when you are in SCALE_WIDTH mode' |
90 | 84 | ); |
91 | 85 | } |
92 | - } |
|
93 | - else if (in_array($this->mode, [LaruploadMediaStyle::CROP, LaruploadMediaStyle::FIT])) { |
|
86 | + } else if (in_array($this->mode, [LaruploadMediaStyle::CROP, LaruploadMediaStyle::FIT])) { |
|
94 | 87 | if (!$this->width or !$this->height) { |
95 | 88 | throw new Exception( |
96 | 89 | 'Width and Height are required when you are in CROP/FIT mode' |
97 | 90 | ); |
98 | 91 | } |
99 | - } |
|
100 | - else if ($this->mode === LaruploadMediaStyle::AUTO) { |
|
92 | + } else if ($this->mode === LaruploadMediaStyle::AUTO) { |
|
101 | 93 | if (!$this->width and !$this->height) { |
102 | 94 | throw new Exception( |
103 | 95 | 'Width and height are required when you are in auto mode' |