Passed
Pull Request — master (#1)
by Artem
01:47
created

ImagineDriver   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
eloc 7
c 1
b 0
f 1
dl 0
loc 28
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A process() 0 6 1
A __construct() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ImageOptimizer;
6
7
use Imagine\Gd\Imagine;
8
9
class ImagineDriver
10
{
11
    /**
12
     * @var Imagine $imagine
13
     */
14
    protected $imagine;
15
16
    public function __construct()
17
    {
18
        $this->imagine = new Imagine();
19
    }
20
21
    /**
22
     * process.
23
     *
24
     * @access	public
25
     * @param	string	$path       	
26
     * @param	int   	$width      	
27
     * @param	int   	$height     	
28
     * @param	string	$resizedFile	
29
     * @return	void
30
     */
31
    public function process(string $path, int $width, int $height, string $resizedFile): void
32
    {
33
        $this->imagine->open($path)
34
            ->thumbnail(new Box($width, $height), ImageInterface::THUMBNAIL_OUTBOUND)
0 ignored issues
show
Bug introduced by
The type ImageOptimizer\Box was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
Bug introduced by
The type ImageOptimizer\ImageInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
35
            ->save($resizedFile)
36
            ->save($resizedFile . '.webp');
37
    }
38
}
39