Completed
Push — master ( f5da21...ccf0eb )
by Anton
16s queued 11s
created

Link::setAcl()   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 string
33
     */
34
    protected $acl;
35
36
    /**
37
     * @var array
38
     */
39
    protected $fields = [];
40
41
    /**
42
     * Constructor of Link
43
     *
44
     * @access  public
45
     *
46
     * @param string $module
47
     * @param string $controller
48
     */
49 15
    public function __construct(string $module, string $controller)
50
    {
51 15
        $this->setModule($module);
52 15
        $this->setController($controller);
53 15
    }
54
55
    /**
56
     * Set ACL privilege
57
     *
58
     * @param string $acl
59
     *
60
     * @return Link
61
     */
62 2
    public function acl(string $acl) : Link
63
    {
64 2
        $this->setAcl($acl);
65 2
        return $this;
66
    }
67
68
    /**
69
     * Set filters for data
70
     *
71
     * @param array $fields
72
     *
73
     * @return Link
74
     */
75
    public function fields(array $fields) : Link
76
    {
77
        $this->setFields($fields);
78
        return $this;
79
    }
80
81
    /**
82
     * @return string
83
     */
84 13
    public function getModule(): string
85
    {
86 13
        return $this->module;
87
    }
88
89
    /**
90
     * @param string $module
91
     */
92 15
    protected function setModule(string $module)
93
    {
94 15
        $this->module = $module;
95 15
    }
96
97
    /**
98
     * @return string
99
     */
100 13
    public function getController(): string
101
    {
102 13
        return $this->controller;
103
    }
104
105
    /**
106
     * @param string $controller
107
     */
108 15
    protected function setController(string $controller)
109
    {
110 15
        $this->controller = $controller;
111 15
    }
112
113
    /**
114
     * @return string|null
115
     */
116 15
    public function getAcl()
117
    {
118 15
        return $this->acl;
119
    }
120
121
    /**
122
     * @param string $acl
123
     */
124 2
    protected function setAcl(string $acl)
125
    {
126 2
        $this->acl = $acl;
127 2
    }
128
129
    /**
130
     * @return array
131
     */
132 13
    public function getFields(): array
133
    {
134 13
        return $this->fields;
135
    }
136
137
    /**
138
     * Setup data filters
139
     *
140
     * @param array $fields
141
     */
142
    protected function setFields(array $fields)
143
    {
144
        $this->fields = $fields;
145
    }
146
}
147