SelectFilter::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 1
crap 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