GraphicResolverFilePath::__invoke()   A
last analyzed

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 callable
36
     */
37
    public static function factory()
38
    {
39
        return new static(
40
            new Bmp()
41
        );
42
    }
43
}
44