1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace PhpAbac\Model; |
4
|
|
|
|
5
|
|
|
class PolicyRuleAttribute |
6
|
|
|
{ |
7
|
|
|
/** @var PhpAbac\Model\AbstractAttribute **/ |
8
|
|
|
protected $attribute; |
9
|
|
|
/** @var string **/ |
10
|
|
|
protected $comparisonType; |
11
|
|
|
/** @var string **/ |
12
|
|
|
protected $comparison; |
13
|
|
|
/** @var mixed **/ |
14
|
|
|
protected $value; |
15
|
|
|
/** @var array **/ |
16
|
|
|
protected $extraData; |
17
|
|
|
/** @var array Extended parameter */ |
18
|
|
|
protected $getter_params_a = []; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* @param \PhpAbac\Model\AbstractAttribute $attribute |
22
|
|
|
* |
23
|
|
|
* @return \PhpAbac\Model\PolicyRuleAttribute |
24
|
|
|
*/ |
25
|
11 |
|
public function setAttribute(AbstractAttribute $attribute) |
26
|
|
|
{ |
27
|
11 |
|
$this->attribute = $attribute; |
|
|
|
|
28
|
|
|
|
29
|
11 |
|
return $this; |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @return \PhpAbac\Model\AbstractAttribute |
34
|
|
|
*/ |
35
|
11 |
|
public function getAttribute() |
36
|
|
|
{ |
37
|
11 |
|
return $this->attribute; |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @param string $comparisonType |
42
|
|
|
* |
43
|
|
|
* @return \PhpAbac\Model\PolicyRuleAttribute |
44
|
|
|
*/ |
45
|
11 |
|
public function setComparisonType($comparisonType) |
46
|
|
|
{ |
47
|
11 |
|
$this->comparisonType = $comparisonType; |
48
|
|
|
|
49
|
11 |
|
return $this; |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @return string |
54
|
|
|
*/ |
55
|
11 |
|
public function getComparisonType() |
56
|
|
|
{ |
57
|
11 |
|
return $this->comparisonType; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @param string $comparison |
62
|
|
|
* |
63
|
|
|
* @return \PhpAbac\Model\PolicyRuleAttribute |
64
|
|
|
*/ |
65
|
11 |
|
public function setComparison($comparison) |
66
|
|
|
{ |
67
|
11 |
|
$this->comparison = $comparison; |
68
|
|
|
|
69
|
11 |
|
return $this; |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* @return string |
74
|
|
|
*/ |
75
|
10 |
|
public function getComparison() |
76
|
|
|
{ |
77
|
10 |
|
return $this->comparison; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* @param mixed $value |
82
|
|
|
* |
83
|
|
|
* @return \PhpAbac\Model\PolicyRuleAttribute |
84
|
|
|
*/ |
85
|
11 |
|
public function setValue($value) |
86
|
|
|
{ |
87
|
11 |
|
$this->value = $value; |
88
|
|
|
|
89
|
11 |
|
return $this; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* @return mixed |
94
|
|
|
*/ |
95
|
11 |
|
public function getValue() |
96
|
|
|
{ |
97
|
11 |
|
return $this->value; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* @param array $extraData |
102
|
|
|
* @return \PhpAbac\Model\PolicyRuleAttribute |
103
|
|
|
*/ |
104
|
2 |
|
public function setExtraData($extraData) { |
105
|
2 |
|
$this->extraData = $extraData; |
106
|
|
|
|
107
|
2 |
|
return $this; |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* @param string $key |
112
|
|
|
* @param string $value |
113
|
|
|
* @return \PhpAbac\Model\PolicyRuleAttribute |
114
|
|
|
*/ |
115
|
3 |
|
public function addExtraData($key, $value) { |
116
|
3 |
|
$this->extraData[$key] = $value; |
117
|
|
|
|
118
|
3 |
|
return $this; |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* @param string $key |
123
|
|
|
* @return \PhpAbac\Model\PolicyRuleAttribute |
124
|
|
|
*/ |
125
|
3 |
|
public function removeExtraData($key) { |
126
|
3 |
|
if(isset($this->extraData[$key])) { |
|
|
|
|
127
|
3 |
|
unset($this->extraData[$key]); |
128
|
3 |
|
} |
129
|
3 |
|
return $this; |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
/** |
133
|
|
|
* @return array |
134
|
|
|
*/ |
135
|
7 |
|
public function getExtraData() { |
136
|
7 |
|
return $this->extraData; |
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
/** |
140
|
|
|
* @param array $value |
141
|
|
|
* |
142
|
|
|
* @return static |
143
|
|
|
*/ |
144
|
5 |
|
public function setGetterParams($value) { |
145
|
5 |
|
$this->getter_params_a = $value; |
146
|
|
|
|
147
|
5 |
|
return $this; |
148
|
|
|
} |
149
|
|
|
|
150
|
|
|
/** |
151
|
|
|
* @return array |
152
|
|
|
*/ |
153
|
4 |
|
public function getGetterParams() { |
154
|
4 |
|
return $this->getter_params_a; |
155
|
|
|
} |
156
|
|
|
} |
157
|
|
|
|
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..