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 | * @return bool |
||
52 | */ |
||
53 | public function has(string $scopePolicy): bool |
||
57 | |||
58 | /** |
||
59 | * @param string $scopePolicyName |
||
60 | * @return ScopePolicyInterface |
||
61 | */ |
||
62 | public function get(string $scopePolicyName): ScopePolicyInterface |
||
68 | |||
69 | /** |
||
70 | * @return ScopePolicyInterface|null |
||
71 | */ |
||
72 | public function default(): ?ScopePolicyInterface |
||
80 | |||
81 | /** |
||
82 | * @param array $scope |
||
83 | * @param Client $client |
||
84 | * |
||
85 | * @return array |
||
86 | */ |
||
87 | public function check(array $scope, Client $client): array |
||
99 | |||
100 | /** |
||
101 | * @param Client $client |
||
102 | * |
||
103 | * @return ScopePolicyInterface|null |
||
104 | */ |
||
105 | private function getForClient(Client $client): ?ScopePolicyInterface |
||
115 | } |
||
116 |