Completed
Push — master ( 83cea8...e47c19 )
by Anton
17s queued 12s
created

Link   A

Complexity

Total Complexity 11

Size/Duplication

Total Lines 124
Duplicated Lines 0 %

Test Coverage

Coverage 82.76%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 19
c 1
b 0
f 0
dl 0
loc 124
ccs 24
cts 29
cp 0.8276
rs 10
wmc 11

11 Methods

Rating   Name   Duplication   Size   Complexity  
A getAcl() 0 3 1
A getModule() 0 3 1
A setModule() 0 3 1
A setAcl() 0 3 1
A getFields() 0 3 1
A acl() 0 4 1
A __construct() 0 4 1
A setFields() 0 3 1
A setController() 0 3 1
A fields() 0 4 1
A getController() 0 3 1
1
<?php
2
3
/**
4
 * Bluz Framework Component
5
 *
6
 * @copyright Bluz PHP Team
7
 * @link      https://github.com/bluzphp/framework
8
 */
9
10
declare(strict_types=1);
11
12
namespace Bluz\Controller\Mapper;
13
14
/**
15
 * Link
16
 *
17
 * @package  Bluz\Controller\Mapper
18
 * @author   Anton Shevchuk
19
 */
20
class Link
21
{
22
    /**
23
     * @var string
24
     */
25
    protected $module;
26
27
    /**
28
     * @var string
29
     */
30
    protected $controller;
31
32
    /**
33
     * @var string
34
     */
35
    protected $acl;
36
37
    /**
38
     * @var array
39
     */
40
    protected $fields = [];
41
42
    /**
43
     * Constructor of Link
44
     *
45
     * @param string $module
46
     * @param string $controller
47
     */
48 24
    public function __construct(string $module, string $controller)
49
    {
50 24
        $this->setModule($module);
51 24
        $this->setController($controller);
52 24
    }
53
54
    /**
55
     * Set ACL privilege
56
     *
57
     * @param string $acl
58
     *
59
     * @return Link
60
     */
61 2
    public function acl(string $acl): Link
62
    {
63 2
        $this->setAcl($acl);
64 2
        return $this;
65
    }
66
67
    /**
68
     * Set filters for data
69
     *
70
     * @param array $fields
71
     *
72
     * @return Link
73
     */
74
    public function fields(array $fields): Link
75
    {
76
        $this->setFields($fields);
77
        return $this;
78
    }
79
80
    /**
81
     * @return string
82
     */
83 22
    public function getModule(): ?string
84
    {
85 22
        return $this->module;
86
    }
87
88
    /**
89
     * @param string $module
90
     */
91 24
    protected function setModule(string $module): void
92
    {
93 24
        $this->module = $module;
94 24
    }
95
96
    /**
97
     * @return string
98
     */
99 22
    public function getController(): ?string
100
    {
101 22
        return $this->controller;
102
    }
103
104
    /**
105
     * @param string $controller
106
     */
107 24
    protected function setController(string $controller): void
108
    {
109 24
        $this->controller = $controller;
110 24
    }
111
112
    /**
113
     * @return string|null
114
     */
115 24
    public function getAcl(): ?string
116
    {
117 24
        return $this->acl;
118
    }
119
120
    /**
121
     * @param string $acl
122
     */
123 2
    protected function setAcl(string $acl): void
124
    {
125 2
        $this->acl = $acl;
126 2
    }
127
128
    /**
129
     * @return array
130
     */
131 22
    public function getFields(): array
132
    {
133 22
        return $this->fields;
134
    }
135
136
    /**
137
     * Setup data filters
138
     *
139
     * @param array $fields
140
     */
141
    protected function setFields(array $fields): void
142
    {
143
        $this->fields = $fields;
144
    }
145
}
146