Container   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 72
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 3
dl 0
loc 72
ccs 14
cts 14
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getHelper() 0 10 2
A getMiddleware() 0 4 1
1
<?php
2
/**
3
 * UrlHelper
4
 *
5
 * PHP version 5
6
 *
7
 * Copyright (C) 2016 Jake Johns
8
 *
9
 * This software may be modified and distributed under the terms
10
 * of the MIT license.  See the LICENSE file for details.
11
 *
12
 * @category  ViewHelper
13
 * @package   Jnjxp\UrlHelper
14
 * @author    Jake Johns <[email protected]>
15
 * @copyright 2016 Jake Johns
16
 * @license   http://jnj.mit-license.org/2016 MIT License
17
 * @link      http://jakejohns.net
18
 */
19
20
namespace Jnjxp\UrlHelper;
21
22
use Aura\Router\RouterContainer;
23
24
/**
25
 * Container
26
 *
27
 * @category Container
28
 * @package  Jnjxp\UrlHelper
29
 * @author   Jake Johns <[email protected]>
30
 * @license  http://jnj.mit-license.org/ MIT License
31
 * @link     http://jakejohns.net
32
 */
33
class Container
34
{
35
    /**
36
     * Helper
37
     *
38
     * @var UrlHelper
39
     *
40
     * @access protected
41
     */
42
    protected $helper;
43
44
    /**
45
     * Generator
46
     *
47
     * @var \Aura\Router\Generator
48
     *
49
     * @access protected
50
     */
51
    protected $generator;
52
53
    /**
54
     * Matcher
55
     *
56
     * @var \Aura\Router\Matcher
57
     *
58
     * @access protected
59
     */
60
    protected $matcher;
61
62
    /**
63
     * __construct
64
     *
65
     * @param RouterContainer $routerContainer Aura router container
66
     *
67
     * @access public
68
     */
69 2
    public function __construct(RouterContainer $routerContainer)
70
    {
71 2
        $this->generator = $routerContainer->getGenerator();
72 2
        $this->matcher   = $routerContainer->getMatcher();
73 2
    }
74
75
    /**
76
     * Get Helper
77
     *
78
     * @return UrlHelper
79
     *
80
     * @access public
81
     */
82 2
    public function getHelper()
83
    {
84 2
        if (null === $this->helper) {
85 2
            $this->helper = new UrlHelper(
86 2
                $this->generator,
87 2
                $this->matcher
88 2
            );
89 2
        }
90 2
        return $this->helper;
91
    }
92
93
    /**
94
     * Get Middleware
95
     *
96
     * @return UrlHelperMiddleware
97
     *
98
     * @access public
99
     */
100 1
    public function getMiddleware()
101
    {
102 1
        return new Middleware($this->getHelper());
103
    }
104
}
105