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
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* @param \PhpAbac\Model\AbstractAttribute $attribute |
20
|
|
|
* |
21
|
|
|
* @return \PhpAbac\Model\PolicyRuleAttribute |
22
|
|
|
*/ |
23
|
8 |
|
public function setAttribute(AbstractAttribute $attribute) |
24
|
|
|
{ |
25
|
8 |
|
$this->attribute = $attribute; |
|
|
|
|
26
|
|
|
|
27
|
8 |
|
return $this; |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @return \PhpAbac\Model\AbstractAttribute |
32
|
|
|
*/ |
33
|
8 |
|
public function getAttribute() |
34
|
|
|
{ |
35
|
8 |
|
return $this->attribute; |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @param string $comparisonType |
40
|
|
|
* |
41
|
|
|
* @return \PhpAbac\Model\PolicyRuleAttribute |
42
|
|
|
*/ |
43
|
8 |
|
public function setComparisonType($comparisonType) |
44
|
|
|
{ |
45
|
8 |
|
$this->comparisonType = $comparisonType; |
46
|
|
|
|
47
|
8 |
|
return $this; |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @return string |
52
|
|
|
*/ |
53
|
8 |
|
public function getComparisonType() |
54
|
|
|
{ |
55
|
8 |
|
return $this->comparisonType; |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @param string $comparison |
60
|
|
|
* |
61
|
|
|
* @return \PhpAbac\Model\PolicyRuleAttribute |
62
|
|
|
*/ |
63
|
8 |
|
public function setComparison($comparison) |
64
|
|
|
{ |
65
|
8 |
|
$this->comparison = $comparison; |
66
|
|
|
|
67
|
8 |
|
return $this; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* @return string |
72
|
|
|
*/ |
73
|
7 |
|
public function getComparison() |
74
|
|
|
{ |
75
|
7 |
|
return $this->comparison; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* @param mixed $value |
80
|
|
|
* |
81
|
|
|
* @return \PhpAbac\Model\PolicyRuleAttribute |
82
|
|
|
*/ |
83
|
8 |
|
public function setValue($value) |
84
|
|
|
{ |
85
|
8 |
|
$this->value = $value; |
86
|
|
|
|
87
|
8 |
|
return $this; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* @return mixed |
92
|
|
|
*/ |
93
|
8 |
|
public function getValue() |
94
|
|
|
{ |
95
|
8 |
|
return $this->value; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* @param array $extraData |
100
|
|
|
* @return \PhpAbac\Model\PolicyRuleAttribute |
101
|
|
|
*/ |
102
|
2 |
|
public function setExtraData($extraData) { |
103
|
2 |
|
$this->extraData = $extraData; |
104
|
|
|
|
105
|
2 |
|
return $this; |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* @param string $key |
110
|
|
|
* @param string $value |
111
|
|
|
* @return \PhpAbac\Model\PolicyRuleAttribute |
112
|
|
|
*/ |
113
|
1 |
|
public function addExtraData($key, $value) { |
114
|
1 |
|
$this->extraData[$key] = $value; |
115
|
|
|
|
116
|
1 |
|
return $this; |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
/** |
120
|
|
|
* @param string $key |
121
|
|
|
* @return \PhpAbac\Model\PolicyRuleAttribute |
122
|
|
|
*/ |
123
|
1 |
|
public function removeExtraData($key) { |
124
|
1 |
|
if(isset($this->extraData[$key])) { |
|
|
|
|
125
|
1 |
|
unset($this->extraData[$key]); |
126
|
1 |
|
} |
127
|
1 |
|
return $this; |
128
|
|
|
} |
129
|
|
|
|
130
|
|
|
/** |
131
|
|
|
* @return array |
132
|
|
|
*/ |
133
|
4 |
|
public function getExtraData() { |
134
|
4 |
|
return $this->extraData; |
135
|
|
|
} |
136
|
|
|
} |
137
|
|
|
|
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..