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.

SecurityListener   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 4
Bugs 0 Features 1
Metric Value
c 4
b 0
f 1
dl 0
loc 34
wmc 4
lcom 1
cbo 3
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A addPolicy() 0 4 1
A preCommand() 0 12 3
1
<?php
2
3
/**
4
 *
5
 * Copyright 2014 Simon Mönch.
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace APL\Security;
12
13
use APL\Event\PreCommandEvent;
14
use APL\Exception\SecurityException;
15
16
/**
17
 *
18
 * @author Simon Mönch
19
 * @author David Badura <[email protected]>
20
 */
21
class SecurityListener
22
{
23
    /**
24
     *
25
     * @var PolicyInterface[]
26
     */
27
    protected $polices = array();
28
29
    /**
30
     *
31
     * @param PolicyInterface $policy
32
     */
33
    public function addPolicy(PolicyInterface $policy)
34
    {
35
        $this->polices[] = $policy;
36
    }
37
38
    /**
39
     *
40
     * @param PreCommandEvent $event
41
     */
42
    public function preCommand(PreCommandEvent $event)
43
    {
44
        $command = $event->getCommand();
45
46
        foreach ($this->polices as $policy) {
47
            if ($policy->check($command)) {
48
                continue;
49
            }
50
51
            throw new SecurityException($command, $policy);
52
        }
53
    }
54
}
55