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.
Completed
Push — master ( 0baec8...65564e )
by Jonny
04:04
created

ProcedureLoaderFactory::createFileLocator()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 3

Importance

Changes 0
Metric Value
dl 0
loc 8
c 0
b 0
f 0
ccs 4
cts 4
cp 1
rs 9.4285
cc 3
eloc 4
nc 2
nop 1
crap 3
1
<?php
2
3
/*
4
 * This file is part of the php-phantomjs.
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
namespace JonnyW\PhantomJs\Procedure;
11
12
use Symfony\Component\Config\FileLocator;
13
14
/**
15
 * PHP PhantomJs
16
 *
17
 * @author Jon Wenmoth <[email protected]>
18
 */
19
class ProcedureLoaderFactory implements ProcedureLoaderFactoryInterface
20
{
21
    /**
22
     * Procedure factory.
23
     *
24
     * @var \JonnyW\PhantomJs\Procedure\ProcedureFactoryInterface
25
     * @access protected
26
     */
27
    protected $procedureFactory;
28
29
    /**
30
     * Internal constructor.
31
     *
32
     * @access public
33
     * @param \JonnyW\PhantomJs\Procedure\ProcedureFactoryInterface $procedureFactory
34
     */
35 3
    public function __construct(ProcedureFactoryInterface $procedureFactory)
36
    {
37 3
        $this->procedureFactory = $procedureFactory;
38 3
    }
39
40
    /**
41
     * Create procedure loader instance.
42
     *
43
     * @access public
44
     * @param  string                                      $directory
45
     * @return \JonnyW\PhantomJs\Procedure\ProcedureLoader
46
     */
47 5
    public function createProcedureLoader($directory)
48
    {
49 5
        $procedureFactory = $this->procedureFactory;
50 5
        $fileLocator      = $this->createFileLocator($directory);
51
52 4
        $procedureLoader = new ProcedureLoader(
53 4
            $procedureFactory,
54
            $fileLocator
55 4
        );
56
57 4
        return $procedureLoader;
58
    }
59
60
    /**
61
     * Create file locator instance.
62
     *
63
     * @access protected
64
     * @param  string                                $directory
65
     * @return \Symfony\Component\Config\FileLocator
66
     * @throws \InvalidArgumentException
67
     */
68 5
    protected function createFileLocator($directory)
69
    {
70 5
        if (!is_dir($directory) || !is_readable($directory)) {
71 1
            throw new \InvalidArgumentException(sprintf('Could not create procedure loader as directory does not exist or is not readable: "%s"', $directory));
72
        }
73
74 4
        return new FileLocator($directory);
75
    }
76
}
77