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

VideoAnalyzerFactory::__invoke()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 11
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 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 VideoAnalyzerFactory
20
{
21 3
    public function __invoke(ContainerInterface $container): VideoAnalyzerInterface
22
    {
23 3
        if ($container->has(LoggerConfigInterface::class)) {
24 1
            $logger = $container->get(LoggerConfigInterface::class)->getLogger();
25
        } else {
26 2
            $logger = new NullLogger();
27
        }
28
29 3
        return new VideoAnalyzer(
30 3
            $container->get(FFMpegConfigInterface::class),
31
            $logger
32
        );
33
    }
34
}
35