Completed
Pull Request — master (#435)
by Anton
04:35
created

Link::setModule()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Bluz Framework Component
4
 *
5
 * @copyright Bluz PHP Team
6
 * @link      https://github.com/bluzphp/framework
7
 */
8
9
declare(strict_types=1);
10
11
namespace Bluz\Controller\Mapper;
12
13
/**
14
 * Link
15
 *
16
 * @package  Bluz\Controller\Mapper
17
 * @author   Anton Shevchuk
18
 */
19
class Link
20
{
21
    /**
22
     * @var string
23
     */
24
    protected $module;
25
26
    /**
27
     * @var string
28
     */
29
    protected $controller;
30
31
    /**
32
     * @var array
33
     */
34
    protected $params;
35
36
    /**
37
     * @var string
38
     */
39
    protected $acl;
40
41
    /**
42
     * @var array
43
     */
44
    protected $filters = [];
45
46
    /**
47
     * Constructor of Link
48
     *
49
     * @access  public
50
     *
51
     * @param string $module
52
     * @param string $controller
53
     */
54 15
    public function __construct(string $module, string $controller)
55
    {
56 15
        $this->setModule($module);
57 15
        $this->setController($controller);
58 15
    }
59
60
    /**
61
     * Set ACL privilege
62
     *
63
     * @param string $acl
64
     *
65
     * @return Link
66
     */
67 2
    public function acl(string $acl) : Link
68
    {
69 2
        $this->setAcl($acl);
70 2
        return $this;
71
    }
72
73
    /**
74
     * Set filters for data
75
     *
76
     * @param array $filters
77
     *
78
     * @return Link
79
     */
80
    public function filter(array $filters) : Link
81
    {
82
        $this->setFilters($filters);
83
        return $this;
84
    }
85
86
    /**
87
     * @return string
88
     */
89 13
    public function getModule(): string
90
    {
91 13
        return $this->module;
92
    }
93
94
    /**
95
     * @param string $module
96
     */
97 15
    protected function setModule(string $module)
98
    {
99 15
        $this->module = $module;
100 15
    }
101
102
    /**
103
     * @return string
104
     */
105 13
    public function getController(): string
106
    {
107 13
        return $this->controller;
108
    }
109
110
    /**
111
     * @param string $controller
112
     */
113 15
    protected function setController(string $controller)
114
    {
115 15
        $this->controller = $controller;
116 15
    }
117
118
    /**
119
     * @return array
120
     */
121 13
    public function getParams(): array
122
    {
123 13
        return $this->params;
124
    }
125
126
    /**
127
     * @param array $params
128
     */
129 13
    public function setParams(array $params)
130
    {
131 13
        $this->params = $params;
132 13
    }
133
134
    /**
135
     * @return string|null
136
     */
137 15
    public function getAcl()
138
    {
139 15
        return $this->acl;
140
    }
141
142
    /**
143
     * @param string $acl
144
     */
145 2
    protected function setAcl(string $acl)
146
    {
147 2
        $this->acl = $acl;
148 2
    }
149
150
    /**
151
     * @return array
152
     */
153
    public function getFilters(): array
154
    {
155
        return $this->filters;
156
    }
157
158
    /**
159
     * Setup data filters
160
     *
161
     * @param array $filters
162
     */
163
    protected function setFilters(array $filters)
164
    {
165
        $this->filters = $filters;
166
    }
167
}
168