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.

Studioforty9_Recaptcha_Model_Routes   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 86
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 8
lcom 1
cbo 0
dl 0
loc 86
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A add() 0 9 1
A remove() 0 8 2
A find() 0 10 2
A clear() 0 6 1
A count() 0 4 1
A toArray() 0 4 1
1
<?php
2
/**
3
 * Studioforty9_Recaptcha
4
 *
5
 * @category  Studioforty9
6
 * @package   Studioforty9_Recaptcha
7
 * @author    StudioForty9 <[email protected]>
8
 * @copyright 2015 StudioForty9 (http://www.studioforty9.com)
9
 * @license   https://github.com/studioforty9/recaptcha/blob/master/LICENCE BSD
10
 * @version   1.5.7
11
 * @link      https://github.com/studioforty9/recaptcha
12
 */
13
14
/**
15
 * Studioforty9_Recaptcha_Model_Routes
16
 *
17
 * @category   Studioforty9
18
 * @package    Studioforty9_Recaptcha
19
 * @subpackage Model
20
 * @author     StudioForty9 <[email protected]>
21
 */
22
class Studioforty9_Recaptcha_Model_Routes implements Countable
23
{
24
    /** @var array */
25
    protected $routes = array();
0 ignored issues
show
Coding Style introduced by
Protected member variable "routes" must contain a leading underscore
Loading history...
26
    
27
    /**
28
     * Add a route.
29
     *
30
     * @param string $route
31
     * @param string $label
32
     * @return self
33
     */
34
    public function add($route, $label)
35
    {
36
        $this->routes[$route] = array(
37
            'value' => $route,
38
            'label' => $label,
39
        );
40
        
41
        return $this;
42
    }
43
    
44
    /**
45
     * Remove a route.
46
     *
47
     * @param string $route
48
     * @return self
49
     */
50
    public function remove($route)
51
    {
52
        if (array_key_exists($route, $this->routes)) {
53
            unset($this->routes[$route]);
54
        }
55
        
56
        return $this;
57
    }
58
    
59
    /**
60
     * Find a route.
61
     *
62
     * @param string $route
63
     * @return array
64
     */
65
    public function find($route)
66
    {
67
        if (! isset($this->routes[$route])) {
68
            throw new Exception(
69
                "$route could not be found or was not allocated."
70
            );
71
        }
72
        
73
        return $this->routes[$route];
74
    }
75
    
76
    /**
77
     * Clear all routes.
78
     *
79
     * @return self
80
     */
81
    public function clear()
82
    {
83
        $this->routes = array();
84
        
85
        return $this;
86
    }
87
    
88
    /**
89
     * Count the number routes.
90
     *
91
     * @return int
92
     */
93
    public function count()
94
    {
95
        return count($this->routes);
96
    }
97
    
98
    /**
99
     * Cast the object to an array.
100
     *
101
     * @return aray
102
     */
103
    public function toArray()
104
    {
105
        return array_values($this->routes);
106
    }
107
}
108