LaruploadMediaStyle   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 12
c 1
b 0
f 1
dl 0
loc 39
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A ffmpegResizeFilter() 0 8 1
1
<?php
2
3
namespace Mostafaznv\Larupload\Enums;
4
5
use FFMpeg\Filters\Video\ResizeFilter;
6
7
enum LaruploadMediaStyle
8
{
9
    /**
10
     * fits to the dimensions, might introduce anamorphosis
11
     * old name: EXACT
12
     */
13
    case FIT;
14
15
    /**
16
     * resizes the media inside the given dimension, no anamorphosis
17
     */
18
    case AUTO;
19
20
    /**
21
     * resizes the video to fit the dimension width, no anamorphosis
22
     * old name: PORTRAIT
23
     */
24
    case SCALE_WIDTH;
25
26
    /**
27
     * resizes the video to fit the dimension height, no anamorphosis
28
     * old name: LANDSCAPE
29
     */
30
    case SCALE_HEIGHT;
31
32
    /**
33
     * scale/crop the media with the exact dimension, no anamorphosis
34
     */
35
    case CROP;
36
37
38
    public function ffmpegResizeFilter(): ?string
39
    {
40
        return match ($this) {
41
            self::FIT          => ResizeFilter::RESIZEMODE_FIT,
42
            self::AUTO         => ResizeFilter::RESIZEMODE_INSET,
43
            self::SCALE_WIDTH  => ResizeFilter::RESIZEMODE_SCALE_WIDTH,
44
            self::SCALE_HEIGHT => ResizeFilter::RESIZEMODE_SCALE_HEIGHT,
45
            self::CROP         => null,
46
        };
47
    }
48
}
49