Completed
Pull Request — master (#32)
by John
12:17 queued 04:22
created

GraphicResolverFilePath::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Graze\CiffRenderer\GraphicResolver;
4
5
use Urbanplum\Bmp\Bmp;
6
7
/**
8
 * Resolves an image resource from it's file path
9
 */
10
class GraphicResolverFilePath
11
{
12
    /**
13
     * @var Bmp
14
     */
15
    private $bmp;
16
17
    /**
18
     * @param Bmp $bmp
19
     */
20 1
    public function __construct(Bmp $bmp)
21
    {
22 1
        $this->bmp = $bmp;
23 1
    }
24
25
    /**
26
     * @param string $filePath
27
     * @return Resource
28
     */
29 1
    public function __invoke($filePath)
30
    {
31 1
        return $this->bmp->createFromFile($filePath);
32
    }
33
34
    /**
35
     * @return GraphicResolverInterface
0 ignored issues
show
Bug introduced by
The type Graze\CiffRenderer\Graph...raphicResolverInterface 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...
36
     */
37
    public static function factory()
38
    {
39
        return new static(
0 ignored issues
show
Bug Best Practice introduced by
The expression return new static(new Urbanplum\Bmp\Bmp()) returns the type Graze\CiffRenderer\Graph...GraphicResolverFilePath which is incompatible with the documented return type Graze\CiffRenderer\Graph...raphicResolverInterface.
Loading history...
40
            new Bmp()
41
        );
42
    }
43
}
44