Failed Conditions
Push — master ( 34a070...6c283c )
by Adrien
05:56
created

ImagineFactory   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 66.67%

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 20
rs 10
c 0
b 0
f 0
ccs 4
cts 6
cp 0.6667
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 11 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Application\Service;
6
7
use Imagine\Image\ImagineInterface;
8
use Interop\Container\ContainerInterface;
9
10
class ImagineFactory
11
{
12
    /**
13
     * Return the preferred driver available on this system
14
     *
15
     * @param ContainerInterface $container
16
     *
17
     * @return ImagineInterface
18
     */
19 1
    public function __invoke(ContainerInterface $container): ImagineInterface
20
    {
21 1
        if (class_exists('Gmagick')) {
22
            return new \Imagine\Gmagick\Imagine();
23
        }
24
25 1
        if (class_exists('Imagick')) {
26
            return new \Imagine\Imagick\Imagine();
27
        }
28
29 1
        return new \Imagine\Gd\Imagine();
30
    }
31
}
32