Passed
Push — master ( ecde40...94c840 )
by Lucien
01:50
created

Route   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
c 1
b 0
f 0
dl 0
loc 57
rs 10
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getTemplate() 0 3 1
A getPath() 0 3 1
A hasHook() 0 3 1
A getHook() 0 3 1
A __construct() 0 5 1
A hasTemplate() 0 3 1
1
<?php
2
3
namespace TwinDigital\WPTools\Router;
4
5
class Route
6
{
7
8
    protected $hook     = null;
9
10
    protected $path     = null;
11
12
    protected $template = null;
13
14
    /**
15
     * Route constructor.
16
     * @param string $path
17
     * @param null   $hook
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $hook is correct as it would always require null to be passed?
Loading history...
18
     * @param null   $template
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $template is correct as it would always require null to be passed?
Loading history...
19
     */
20
    public function __construct(string $path, $hook = null, $template = null)
21
    {
22
        $this->hook     = $hook;
23
        $this->path     = $path;
24
        $this->template = $template;
25
    }
26
27
    /**
28
     * @return string
29
     */
30
    public function hasHook()
31
    {
32
        return $this->hook !== null;
33
    }
34
35
    /**
36
     * @return string
37
     */
38
    public function getPath()
39
    {
40
        return $this->path;
41
    }
42
43
    /**
44
     * @return string
45
     */
46
    public function getHook()
47
    {
48
        return $this->hook;
49
    }
50
51
    /**
52
     * @return string
53
     */
54
    public function getTemplate()
55
    {
56
        return $this->template;
57
    }
58
59
    public function hasTemplate()
60
    {
61
        return $this->template !== null;
62
    }
63
64
}
65