GraphicResolverFilePath   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 62.5%

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 31
ccs 5
cts 8
cp 0.625
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A __invoke() 0 3 1
A factory() 0 4 1
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 callable
36
     */
37
    public static function factory()
38
    {
39
        return new static(
40
            new Bmp()
41
        );
42
    }
43
}
44