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 ( 0ba6d7...8aa6f4 )
by Miles
03:04
created

ReplacementStore::load()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 12
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 12
ccs 9
cts 9
cp 1
rs 9.4285
cc 3
eloc 8
nc 3
nop 1
crap 3
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.0.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\Variables;
20
21
use \M1\Vars\Resource\AbstractResource;
22
use M1\Vars\Traits\FileTrait;
23
24
/**
25
 * Stores the replacement variables
26
 *
27
 * @since 1.0.0
28
 */
29
class ReplacementStore extends AbstractResource
30
{
31
    /**
32
     * Basic file interaction logic
33
     */
34
    use FileTrait;
35
36
    /**
37
     * Creates new instance of VariableResource
38
     *
39
     * @param \M1\Vars\Vars $vars Instance of the calling Vars
40
     */
41 79
    public function __construct($vars)
42
    {
43 79
        $this->vars = $vars;
44 79
    }
45
46
    /**
47
     * Creates the replacement variable content from a file or array
48
     *
49
     * @param array $replacements The replacements
50
51
     * @throws \RuntimeException If variable data is not array or a file
52
     *
53
     * @return  array The replacement variables
54
     */
55 4
    public function load($replacements)
56
    {
57 4
        if (is_array($replacements)) {
58 2
            $variables = $replacements;
59 4
        } elseif (is_file($replacements)) {
60 1
            $variables = $this->loadContent($replacements);
61 1
        } else {
62 1
            throw new \RuntimeException('Config replacements must be a array or a file');
63
        }
64
65 3
        $this->content = $variables;
0 ignored issues
show
Documentation Bug introduced by
It seems like $variables of type * is incompatible with the declared type array of property $content.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
66 3
    }
67
}
68