1 | <?php |
||
11 | class Judge |
||
12 | { |
||
13 | const RULE_PARAM_DELIMITER = ':'; |
||
14 | const RULE_INVERTER = '!'; |
||
15 | const FIELD_VALUE = 'value'; |
||
16 | const FIELD_FILTERS = 'filters'; |
||
17 | |||
18 | /** |
||
19 | * @var AdapterInterface |
||
20 | */ |
||
21 | protected $adapter; |
||
22 | /** |
||
23 | * @var VoterInterface[] |
||
24 | */ |
||
25 | protected $voters = []; |
||
26 | |||
27 | /** |
||
28 | * Constructor. |
||
29 | * |
||
30 | * @param AdapterInterface $adapter |
||
31 | * @param VoterInterface[] $voters |
||
32 | */ |
||
33 | 59 | public function __construct(AdapterInterface $adapter, array $voters = []) |
|
38 | |||
39 | /** |
||
40 | * Decides multiple rules. |
||
41 | * |
||
42 | * @param string|array $rules |
||
43 | * @param mixed $user |
||
44 | * |
||
45 | * @return bool |
||
46 | */ |
||
47 | 51 | protected function decideRules($rules, $user = null) |
|
77 | |||
78 | /** |
||
79 | * Decides a single rule. |
||
80 | * |
||
81 | * @param string $rule |
||
82 | * @param mixed $user |
||
83 | * |
||
84 | * @return bool |
||
85 | */ |
||
86 | 40 | protected function decideRule($rule, $user = null) |
|
128 | } |
||
129 |