GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

FileSystemLoader::load()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
ccs 5
cts 5
cp 1
cc 2
eloc 5
nc 2
nop 1
crap 2
1
<?php
2
namespace HtImgModule\Imagine\Loader;
3
4
use HtImgModule\Imagine\Resolver\ResolverInterface;
5
use HtImgModule\Exception;
6
7
class FileSystemLoader implements LoaderInterface
8
{
9
    /**
10
     * @var ResolverInterface
11
     */
12
    protected $resolver;
13
14
    /**
15
     * @var SimpleFileSystemLoader
16
     */
17
    protected $loader;
18
19
    /**
20
     * Constructor
21
     *
22
     * @param ResolverInterface $resolver
23
     */
24 3
    public function __construct(ResolverInterface $resolver)
25
    {
26 3
        $this->resolver = $resolver;
27 3
        $this->loader   = new SimpleFileSystemLoader(null);
28 3
    }
29
30
    /**
31
     * {@inheritDoc}
32
     */
33 2
    public function load($path)
34
    {
35 2
        $imagePath = $this->resolver->resolve($path);
36
37 2
        if (!$imagePath) {
38 1
            throw new Exception\ImageNotFoundException(sprintf('Cound not resolve image, "%s"', $path));
39
        }
40
41 1
        return $this->loader->load($imagePath);
42
    }
43
}
44