UrlGenerator   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
dl 0
loc 19
rs 10
c 1
b 0
f 0
ccs 0
cts 4
cp 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A hasRoute() 0 7 2
1
<?php
2
3
namespace Nip\Router\Generator;
4
5
use Nip\Router\RequestContext;
6
use Nip\Router\RouteCollection;
7
use Symfony\Component\Routing\Route;
8
9
/**
10
 * Class UrlGenerator
11
 * @package Nip\Router\Generator
12
 * @method RequestContext getContext()
13
 */
14
class UrlGenerator extends \Symfony\Component\Routing\Generator\UrlGenerator
15
{
16
    use Traits\FormattingTrait;
17
    use Traits\HasDefaultRouteTrait;
18
    use Traits\HasPreviousUrlTrait;
19
    use Traits\HasRequestTrait;
20
    use Traits\UrlFunctionTrait;
21
22
    /**
23
     * @param $name
24
     * @return bool
25
     */
26
    public function hasRoute($name)
27
    {
28
        if ($this->routes instanceof RouteCollection) {
29
            return $this->routes->has($name);
0 ignored issues
show
introduced by
The method has() does not exist on Symfony\Component\Routing\RouteCollection. Are you sure you never get this type here, but always one of the subclasses? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

29
            return $this->routes->/** @scrutinizer ignore-call */ has($name);
Loading history...
30
        }
31
32
        return $this->routes->get($name) instanceof Route;
33
    }
34
}
35