ImagineFactory   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 42.86%

Importance

Changes 0
Metric Value
dl 0
loc 33
ccs 3
cts 7
cp 0.4286
rs 10
c 0
b 0
f 0
wmc 4
lcom 1
cbo 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A make() 0 8 3
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