Route   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 66
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
c 1
b 0
f 0
dl 0
loc 66
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
    /**
9
     * @var string
10
     */
11
    protected $path;
12
13
    /**
14
     * @var string|null
15
     */
16
    protected $hook;
17
18
    /**
19
     * @var string|null
20
     */
21
    protected $template;
22
23
    /**
24
     * Route constructor.
25
     * @param string      $path
26
     * @param string|null $hook
27
     * @param string|null $template
28
     */
29
    public function __construct(string $path, $hook = null, $template = null)
30
    {
31
        $this->hook     = $hook;
32
        $this->path     = $path;
33
        $this->template = $template;
34
    }
35
36
    /**
37
     * @return string
38
     */
39
    public function hasHook()
40
    {
41
        return $this->hook !== null;
42
    }
43
44
    /**
45
     * @return string
46
     */
47
    public function getPath()
48
    {
49
        return $this->path;
50
    }
51
52
    /**
53
     * @return string
54
     */
55
    public function getHook()
56
    {
57
        return $this->hook;
58
    }
59
60
    /**
61
     * @return string
62
     */
63
    public function getTemplate()
64
    {
65
        return $this->template;
66
    }
67
68
    public function hasTemplate()
69
    {
70
        return $this->template !== null;
71
    }
72
73
}
74