1 | <?php |
||
19 | final class ScopePolicyManager |
||
20 | { |
||
21 | /** |
||
22 | * @var ScopePolicyInterface[] |
||
23 | */ |
||
24 | private $scopePolicies = []; |
||
25 | |||
26 | /** |
||
27 | * @var string |
||
28 | */ |
||
29 | private $defaultScopePolicy = null; |
||
30 | |||
31 | /** |
||
32 | * @param ScopePolicyInterface $scopePolicy |
||
33 | * @param bool $isDefault |
||
34 | * |
||
35 | * @return ScopePolicyManager |
||
36 | */ |
||
37 | public function add(ScopePolicyInterface $scopePolicy, bool $isDefault = false): ScopePolicyManager |
||
48 | |||
49 | /** |
||
50 | * @param string $scopePolicy |
||
51 | * |
||
52 | * @return bool |
||
53 | */ |
||
54 | public function has(string $scopePolicy): bool |
||
58 | |||
59 | /** |
||
60 | * @param string $scopePolicyName |
||
61 | * |
||
62 | * @return ScopePolicyInterface |
||
63 | */ |
||
64 | public function get(string $scopePolicyName): ScopePolicyInterface |
||
70 | |||
71 | /** |
||
72 | * @return ScopePolicyInterface|null |
||
73 | */ |
||
74 | public function default(): ?ScopePolicyInterface |
||
82 | |||
83 | /** |
||
84 | * @param array $scope |
||
85 | * @param Client $client |
||
86 | * |
||
87 | * @return array |
||
88 | */ |
||
89 | public function check(array $scope, Client $client): array |
||
101 | |||
102 | /** |
||
103 | * @param Client $client |
||
104 | * |
||
105 | * @return ScopePolicyInterface|null |
||
106 | */ |
||
107 | private function getForClient(Client $client): ?ScopePolicyInterface |
||
117 | } |
||
118 |