SelectFilter   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 6
c 1
b 0
f 0
dl 0
loc 23
ccs 7
cts 7
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getFFmpegCLIValue() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * @see       https://github.com/soluble-io/soluble-mediatools for the canonical repository
7
 *
8
 * @copyright Copyright (c) 2018-2020 Sébastien Vanvelthem. (https://github.com/belgattitude)
9
 * @license   https://github.com/soluble-io/soluble-mediatools/blob/master/LICENSE.md MIT
10
 */
11
12
namespace Soluble\MediaTools\Video\Filter;
13
14
use Soluble\MediaTools\Video\Filter\Type\FFMpegVideoFilterInterface;
15
16
final class SelectFilter implements FFMpegVideoFilterInterface
17
{
18
    /** @var null|string */
19
    private $expression;
20
21
    /**
22
     * Select filter.
23
     *
24
     * @see https://ffmpeg.org/ffmpeg-filters.html#select_002c-aselect
25
     *
26
     * @param string|null $expression ffmpeg selected expression
27
     */
28 5
    public function __construct(
29
        ?string $expression = null
30
    ) {
31 5
        $this->expression = $expression;
32 5
    }
33
34 5
    public function getFFmpegCLIValue(): string
35
    {
36 5
        return sprintf(
37 5
            'select=%s',
38 5
            str_replace('"', '\"', $this->expression ?? '')
39
        );
40
    }
41
}
42