Completed
Push — master ( 359fe7...152344 )
by Sébastien
03:49
created

PresetLocator::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Soluble\MediaTools\Preset;
6
7
use Soluble\MediaTools\Preset\MP4\StreamableH264Preset;
8
use Soluble\MediaTools\Preset\Prod\ResolvePreset;
9
use Soluble\MediaTools\Preset\WebM\GoogleVod2019Preset;
10
11
class PresetLocator
12
{
13
    public const BUILTIN_PRESETS = [
14
        ResolvePreset::class,
15
        StreamableH264Preset::class,
16
        GoogleVod2019Preset::class
17
    ];
18
19
    /**
20
     * @var string[]
21
     */
22
    private $paths = [];
23
24
    /**
25
     * @var string[]
26
     */
27
    private $presets;
28
29 2
    public function __construct(array $paths = [])
30
    {
31 2
        $this->paths   = array_merge($paths, [__DIR__]);
32 2
        $this->presets = self::BUILTIN_PRESETS;
33 2
    }
34
35
    public function isSupported(string $name): bool
36
    {
37
        return in_array($name, $this->presets, true);
38
    }
39
}
40