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.

Config::hasAPC()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
ccs 2
cts 2
cp 1
cc 2
eloc 2
nc 2
nop 0
crap 2
1
<?php
2
3
namespace JamesMoss\Flywheel;
4
5
/**
6
 * Config
7
 *
8
 * Responsible for storing variables used throughout a Flywheel instance
9
 */
10
class Config
11
{
12
    protected $path;
13
    protected $options;
14
15
    /**
16
     * Constructor
17
     *
18
     * @param string $path    The full path to a writeable directory, with or
19
     *                        without a trailing slash.
20
     * @param array  $options Any other configuration options.
21
     */
22 38
    public function __construct($path, array $options = array())
23
    {
24 38
        $path = rtrim($path, DIRECTORY_SEPARATOR);
25
26
        // Merge supplied options with the defaults
27 38
        $options = array_merge(array(
28 38
            'formatter'      => new Formatter\JSON,
29 38
            'query_class'    => $this->hasAPC() ? '\\JamesMoss\\Flywheel\\CachedQuery' : '\\JamesMoss\\Flywheel\\Query',
30 38
            'document_class' => '\\JamesMoss\\Flywheel\\Document',
31 38
        ), $options);
32
33 38
        $this->path    = $path;
34 38
        $this->options = $options;
35 38
    }
36
37
    /**
38
     * Gets the path set during initialisation
39
     *
40
     * @return string The full file path, with no trailing slash.
41
     */
42 33
    public function getPath()
43
    {
44 33
        return $this->path;
45
    }
46
47
    /**
48
     * Gets a specific option from the config
49
     *
50
     * @param string $name The name of the option to return.
51
     *
52
     * @return mixed The value of the option if it exists or null if it doesnt.
53
     */
54 37
    public function getOption($name)
55
    {
56 37
        return isset($this->options[$name]) ? $this->options[$name] : null;
57
    }
58
59 38
    public function hasAPC()
60
    {
61 38
        return function_exists('apcu_fetch') || function_exists('apc_fetch');
62
    }
63
}
64