Completed
Push — master ( 01f74b...655878 )
by Renato
04:17
created

ImagineFactory::make()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
cc 3
nc 2
nop 1
dl 0
loc 8
ccs 0
cts 4
cp 0
crap 12
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace NwLaravel\FileStorage;
4
5
use Intervention\Image\ImageManager;
6
use Intervention\Image\Image;
7
8
class ImagineFactory
9
{
10
    /**
11
     * @var ImageManager
12
     */
13
    protected $manager;
14
15
    /**
16
     * Construct
17
     *
18
     * @param ImageManager $manager
19
     */
20 1
    public function __construct(ImageManager $manager)
21
    {
22 1
        $this->manager = $manager;
23 1
    }
24
25
    /**
26
     * Factory
27
     *
28
     * @param string $path
29
     *
30
     * @return Imagine
31
     */
32
    public function make($path)
33
    {
34
        if (extension_loaded('imagick') && class_exists('Imagick')) {
35
            return new ImagineImagick($path, $this->manager);
0 ignored issues
show
Unused Code introduced by
The call to ImagineImagick::__construct() has too many arguments starting with $this->manager.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
36
        }
37
38
        return new ImagineGd($path, $this->manager);
39
    }
40
}
41