Completed
Pull Request — master (#17)
by John
03:40
created

FilepathGraphicResolver   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 3
Bugs 1 Features 0
Metric Value
wmc 2
c 3
b 1
f 0
lcom 0
cbo 2
dl 0
loc 17
ccs 0
cts 5
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 9 2
1
<?php
2
3
namespace Graze\CiffRenderer\GraphicResolver;
4
5
use Graze\CiffRenderer\GraphicResolver\GraphicResolverInterface;
6
use Graze\CiffRenderer\Exception\RuntimeException;
7
use Urbanplum\PhpBmp\PhpBmp;
8
9
/**
10
 * Resolves an image resource from it's file path
11
 */
12
class FilepathGraphicResolver implements GraphicResolverInterface
13
{
14
    /**
15
     * @param string $filePath
16
     *
17
     * @return Resource
18
     */
19
    public function __invoke($filePath)
20
    {
21
        try {
22
            $phpBmp = new PhpBmp();
23
            return $phpBmp->create($filePath);
24
        } catch (\Exception $e) {
25
            throw new RuntimeException($e);
26
        }
27
    }
28
}
29