Passed
Push — master ( 4a80fe...22f802 )
by Sébastien
01:51
created

VideoConverterFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 8
dl 0
loc 13
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 11 2
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-2019 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;
13
14
use Psr\Container\ContainerInterface;
15
use Psr\Log\NullLogger;
16
use Soluble\MediaTools\Video\Config\FFMpegConfigInterface;
17
use Soluble\MediaTools\Video\Config\LoggerConfigInterface;
18
19
class VideoConverterFactory
20
{
21 18
    public function __invoke(ContainerInterface $container): VideoConverterInterface
22
    {
23 18
        if ($container->has(LoggerConfigInterface::class)) {
24 1
            $logger = $container->get(LoggerConfigInterface::class)->getLogger();
25
        } else {
26 17
            $logger = new NullLogger();
27
        }
28
29 18
        return new VideoConverter(
30 18
            $container->get(FFMpegConfigInterface::class),
31
            $logger
32
        );
33
    }
34
}
35