Completed
Branch master (df0330)
by Gabriel
08:50 queued 06:43
created

UrlGenerator::setRequest()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 0
cts 5
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 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);
30
        }
31
32
        return $this->routes->get($name) instanceof Route;
33
    }
34
}
35