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 ( d1c731...ca9b69 )
by Axel
02:45
created

ConfigurationManager   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 0 Features 1
Metric Value
wmc 7
c 3
b 0
f 1
lcom 1
cbo 1
dl 0
loc 53
ccs 22
cts 22
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A parseConfigurationFile() 0 11 4
A getAttributes() 0 3 1
A getRules() 0 3 1
1
<?php
2
3
namespace PhpAbac\Manager;
4
5
use PhpAbac\Loader\YamlAbacLoader;
6
7
use Symfony\Component\Config\FileLocatorInterface;
8
9
class ConfigurationManager {
10
    /** @var FileLocatorInterface **/
11
    protected $locator;
12
    /** @var string **/
13
    protected $format;
14
    /** @var array **/
15
    protected $loaders;
16
    /** @var array **/
17
    protected $rules;
18
    /** @var array **/
19
    protected $attributes;
20
    
21
    /**
22
     * @param FileLocatorInterface $locator
23
     * @param string $format
24
     */
25 7
    public function __construct(FileLocatorInterface $locator, $format = 'yaml') {
26 7
        $this->locator = $locator;
27 7
        $this->format = $format;
28 7
        $this->attributes = [];
29 7
        $this->rules = [];
30 7
        $this->loaders['yaml'] = new YamlAbacLoader($locator);
31 7
    }
32
    
33
    /**
34
     * @param array $configurationFiles
35
     */
36 7
    public function parseConfigurationFile($configurationFiles) {
37 7
        foreach($configurationFiles as $configurationFile) {
0 ignored issues
show
Coding Style introduced by
Expected 1 space after FOREACH keyword; 0 found
Loading history...
38 7
            $config = $this->loaders[$this->format]->load($configurationFile);
39 7
            if(isset($config['attributes'])) {
0 ignored issues
show
Coding Style introduced by
Expected 1 space after IF keyword; 0 found
Loading history...
40 7
                $this->attributes = array_merge($this->attributes, $config['attributes']);
41 7
            }
42 7
            if(isset($config['rules'])) {
0 ignored issues
show
Coding Style introduced by
Expected 1 space after IF keyword; 0 found
Loading history...
43 7
                $this->rules = array_merge($this->rules, $config['rules']);
44 7
            }
45 7
        }
46 7
    }
47
    
48
    /**
49
     * @return array
50
     */
51 7
    public function getAttributes() {
52 7
        return $this->attributes;
53
    }
54
    
55
    /**
56
     * @return array
57
     */
58 3
    public function getRules() {
59 3
        return $this->rules;
60
    }
61
}