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.

Route   A
last analyzed

Complexity

Total Complexity 16

Size/Duplication

Total Lines 164
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 38.1%

Importance

Changes 0
Metric Value
wmc 16
lcom 1
cbo 1
dl 0
loc 164
c 0
b 0
f 0
ccs 16
cts 42
cp 0.381
rs 10

15 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getContent() 0 4 1
A getRouteKey() 0 4 1
A addLocale() 0 7 1
A setName() 0 6 1
A getName() 0 4 1
A setRoutePattern() 0 8 1
A getRoutePattern() 0 4 1
A getPath() 0 4 1
A setPrefix() 0 6 1
A getPrefix() 0 4 1
A setVisible() 0 4 1
A isVisible() 0 4 1
A compile() 0 8 2
A getPattern() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the Tadcka package.
5
 *
6
 * (c) Tadas Gliaubicas <[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
12
namespace Tadcka\Component\Routing\Model;
13
14
use Symfony\Component\Routing\Route as SymfonyRoute;
15
16
/**
17
 * @author Tadas Gliaubicas <[email protected]>
18
 *
19
 * @since 7/1/14 10:54 PM
20
 */
21
abstract class Route extends SymfonyRoute implements RouteInterface
22
{
23
    /**
24
     * @var string
25
     */
26
    protected $name;
27
28
    /**
29
     * @var string
30
     */
31
    protected $routePattern;
32
33
    /**
34
     * @var string
35
     */
36
    protected $prefix;
37
38
    /**
39
     * @var bool
40
     */
41
    protected $recompile = false;
42
43
    /**
44
     * @var bool
45
     */
46
    protected $visible = false;
47
48
    /**
49
     * Constructor.
50
     */
51 3
    public function __construct()
52
    {
53 3
        parent::__construct($this->routePattern);
54
55 3
        $this->setDefaults(array());
56 3
    }
57
58
    /**
59
     * {@inheritdoc}
60
     */
61
    public function getContent()
62
    {
63
        // TODO: Implement getContent() method.
64
    }
65
66
    /**
67
     * {@inheritdoc}
68
     */
69
    public function getRouteKey()
70
    {
71
        return $this->getId();
72
    }
73
74
    /**
75
     * {@inheritdoc}
76
     */
77
    public function addLocale($defaultLocale, array $requirements)
78
    {
79
        $this->prefix = '/{_locale}';
80
81
        $this->setDefault('_locale', $defaultLocale);
82
        $this->addRequirements(array('_locale' => implode('|', $requirements)));
83
    }
84
85
    /**
86
     * {@inheritdoc}
87
     */
88 1
    public function setName($name)
89
    {
90 1
        $this->name = $name;
91
92 1
        return $this;
93
    }
94
95
    /**
96
     * {@inheritdoc}
97
     */
98 3
    public function getName()
99
    {
100 3
        return $this->name;
101
    }
102
103
    /**
104
     * {@inheritdoc}
105
     */
106 2
    public function setRoutePattern($routePattern)
107
    {
108 2
        $this->routePattern = '/' . ltrim(trim($routePattern), '/');
109 2
        $this->setPath($this->routePattern);
110 2
        $this->recompile = true;
111
112 2
        return $this;
113
    }
114
115
    /**
116
     * {@inheritDoc}
117
     */
118 2
    public function getRoutePattern()
119
    {
120 2
        return $this->routePattern;
121
    }
122
123
    /**
124
     * {@inheritDoc}
125
     */
126
    public function getPath()
127
    {
128
        return $this->prefix . $this->getRoutePattern();
129
    }
130
131
    /**
132
     * {@inheritdoc}
133
     */
134
    public function setPrefix($prefix)
135
    {
136
        $this->prefix = $prefix;
137
138
        return $this;
139
    }
140
141
    /**
142
     * {@inheritdoc}
143
     */
144
    public function getPrefix()
145
    {
146
        return $this->prefix;
147
    }
148
149
    /**
150
     * {@inheritdoc}
151
     */
152
    public function setVisible($visible)
153
    {
154
        $this->visible = $visible;
155
    }
156
157
    /**
158
     * {@inheritdoc}
159
     */
160
    public function isVisible()
161
    {
162
        return $this->visible;
163
    }
164
165
    /**
166
     * {@inheritDoc}
167
     */
168
    public function compile()
169
    {
170
        if ($this->recompile) {
171
            parent::setPath($this->getPath());
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (setPath() instead of compile()). Are you sure this is correct? If so, you might want to change this to $this->setPath().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
172
        }
173
174
        return parent::compile();
175
    }
176
177
    /**
178
     * @deprecated
179
     */
180
    public function getPattern()
181
    {
182
        return $this->getPath();
183
    }
184
}
185