|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace PhpAbac\Model; |
|
4
|
|
|
|
|
5
|
|
|
class PolicyRuleAttribute |
|
6
|
|
|
{ |
|
7
|
|
|
/** @var 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
|
11 |
|
public function setAttribute(AbstractAttribute $attribute): PolicyRuleAttribute |
|
21
|
|
|
{ |
|
22
|
11 |
|
$this->attribute = $attribute; |
|
23
|
|
|
|
|
24
|
11 |
|
return $this; |
|
25
|
|
|
} |
|
26
|
|
|
|
|
27
|
11 |
|
public function getAttribute(): AbstractAttribute |
|
28
|
|
|
{ |
|
29
|
11 |
|
return $this->attribute; |
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
11 |
|
public function setComparisonType(string $comparisonType): PolicyRuleAttribute |
|
33
|
|
|
{ |
|
34
|
11 |
|
$this->comparisonType = $comparisonType; |
|
35
|
|
|
|
|
36
|
11 |
|
return $this; |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
10 |
|
public function getComparisonType(): string |
|
40
|
|
|
{ |
|
41
|
10 |
|
return $this->comparisonType; |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
11 |
|
public function setComparison(string $comparison): PolicyRuleAttribute |
|
45
|
|
|
{ |
|
46
|
11 |
|
$this->comparison = $comparison; |
|
47
|
|
|
|
|
48
|
11 |
|
return $this; |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
9 |
|
public function getComparison(): string |
|
52
|
|
|
{ |
|
53
|
9 |
|
return $this->comparison; |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
11 |
|
public function setValue($value): PolicyRuleAttribute |
|
57
|
|
|
{ |
|
58
|
11 |
|
$this->value = $value; |
|
59
|
|
|
|
|
60
|
11 |
|
return $this; |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
10 |
|
public function getValue() |
|
64
|
|
|
{ |
|
65
|
10 |
|
return $this->value; |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
2 |
|
public function setExtraData(array $extraData): PolicyRuleAttribute |
|
69
|
|
|
{ |
|
70
|
2 |
|
$this->extraData = $extraData; |
|
71
|
|
|
|
|
72
|
2 |
|
return $this; |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
3 |
|
public function addExtraData(string $key, $value): PolicyRuleAttribute |
|
76
|
|
|
{ |
|
77
|
3 |
|
$this->extraData[$key] = $value; |
|
78
|
|
|
|
|
79
|
3 |
|
return $this; |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
3 |
|
public function removeExtraData(string $key): PolicyRuleAttribute |
|
83
|
|
|
{ |
|
84
|
3 |
|
if (isset($this->extraData[$key])) { |
|
85
|
3 |
|
unset($this->extraData[$key]); |
|
86
|
|
|
} |
|
87
|
3 |
|
return $this; |
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
6 |
|
public function getExtraData(): array |
|
91
|
|
|
{ |
|
92
|
6 |
|
return $this->extraData; |
|
93
|
|
|
} |
|
94
|
|
|
|
|
95
|
5 |
|
public function setGetterParams(array $value): PolicyRuleAttribute |
|
96
|
|
|
{ |
|
97
|
5 |
|
$this->getter_params_a = $value; |
|
98
|
|
|
|
|
99
|
5 |
|
return $this; |
|
100
|
|
|
} |
|
101
|
|
|
|
|
102
|
4 |
|
public function getGetterParams(): array |
|
103
|
|
|
{ |
|
104
|
4 |
|
return $this->getter_params_a; |
|
105
|
|
|
} |
|
106
|
|
|
} |
|
107
|
|
|
|