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.

AbstractLoader::setSupports()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
/**
4
 * This file is part of the m1\vars library
5
 *
6
 * (c) m1 <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 *
11
 * @package     m1/vars
12
 * @version     1.1.0
13
 * @author      Miles Croxford <[email protected]>
14
 * @copyright   Copyright (c) Miles Croxford <[email protected]>
15
 * @license     http://github.com/m1/vars/blob/master/LICENSE
16
 * @link        http://github.com/m1/vars/blob/master/README.MD Documentation
17
 */
18
19
namespace M1\Vars\Loader;
20
21
/**
22
 * The abstract loader for loaders to be based on
23
 *
24
 * @since 0.1.0
25
 */
26
abstract class AbstractLoader
27
{
28
    /**
29
     * The content from the entity
30
     *
31
     * @var mixed
32
     */
33
    protected $content;
34
35
    /**
36
     * The passed entity to be loaded
37
     *
38
     * @var string
39
     */
40
    protected $entity;
41
42
    /**
43
     * The supported extensions
44
     *
45
     * @var array
46
     */
47
    public static $supported = array();
48
49
    /**
50
     * Construct the loader with the passed entity
51
     *
52
     * @param string $entity The passed entity
53
     */
54 76
    public function __construct($entity)
55
    {
56 76
        $this->entity = $entity;
57 76
    }
58
59
    /**
60
     * The function what loads the content from the entity
61
     *
62
     * @return mixed
63
     */
64
    abstract public function load();
65
66
    /**
67
     * Checks whether the loader supports the file extension
68
     *
69
     * @return bool Does the loader support the file
70
     */
71 75
    public function supports()
72
    {
73 75
        $extension = pathinfo($this->entity, PATHINFO_EXTENSION);
74 75
        return in_array($extension, static::$supported);
75
    }
76
77
    /**
78
     * Sets what the loader supports
79
     *
80
     * @param array $supports Set the extensions the loader supports
81
     */
82 7
    public function setSupports(array $supports)
83
    {
84 7
        static::$supported = $supports;
85 7
    }
86
87
    /**
88
     * Returns the content
89
     *
90
     * @return mixed The content
91
     */
92 68
    public function getContent()
93
    {
94 68
        return $this->content;
95
    }
96
}
97