Completed
Pull Request — 3.x (#140)
by jake
02:04
created

RouteRaw   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 41
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A __invoke() 0 4 1
1
<?php
2
/**
3
 *
4
 * This file is part of Aura for PHP.
5
 *
6
 * @license http://opensource.org/licenses/mit-license.php MIT
7
 *
8
 */
9
namespace Aura\Router\Helper;
10
11
use Aura\Router\Exception\RouteNotFound;
12
use Aura\Router\Generator;
13
14
/**
15
 *
16
 * Generic Raw Route Helper class
17
 *
18
 * @package Aura.Router
19
 *
20
 */
21
class RouteRaw
22
{
23
    /**
24
     *
25
     * The Generator object used by the RouteContainer
26
     *
27
     * @var Generator
28
     *
29
     */
30
    protected $generator;
31
32
    /**
33
     *
34
     * Constructor.
35
     *
36
     * @param Generator $generator The generator object to use
37
     *
38
     */
39 1
    public function __construct(Generator $generator)
40
    {
41 1
        $this->generator = $generator;
42 1
    }
43
44
    /**
45
     *
46
     * Returns the Generator
47
     *
48
     * @param string $name The name of the route to lookup.
49
     *
50
     * @param array $data The data to pass into the route.
51
     *
52
     * @return string The results of calling _Generator::generateRaw_.
53
     *
54
     * @throws RouteNotFound When the route cannot be found.
55
     *
56
     */
57 1
    public function __invoke($name, array $data = [])
58
    {
59 1
        return $this->generator->generateRaw($name, $data);
60
    }
61
}