1 | <?php |
||
18 | final class ScopePolicyManager |
||
19 | { |
||
20 | /** |
||
21 | * @var ScopePolicy[] |
||
22 | */ |
||
23 | private $scopePolicies = []; |
||
24 | |||
25 | /** |
||
26 | * @var string |
||
27 | */ |
||
28 | private $defaultScopePolicy = null; |
||
29 | |||
30 | /** |
||
31 | * @param ScopePolicy $scopePolicy |
||
32 | * @param bool $isDefault |
||
33 | * |
||
34 | * @return ScopePolicyManager |
||
35 | */ |
||
36 | public function add(ScopePolicy $scopePolicy, bool $isDefault = false): self |
||
47 | |||
48 | /** |
||
49 | * @param string $scope |
||
50 | * @param Client $client |
||
51 | * |
||
52 | * @return string |
||
53 | */ |
||
54 | public function apply(string $scope, Client $client): string |
||
66 | |||
67 | /** |
||
68 | * @return string[] |
||
69 | */ |
||
70 | public function all(): array |
||
74 | |||
75 | /** |
||
76 | * @param string $scopePolicy |
||
77 | * |
||
78 | * @return bool |
||
79 | */ |
||
80 | public function has(string $scopePolicy): bool |
||
84 | |||
85 | /** |
||
86 | * @param string $scopePolicyName |
||
87 | * |
||
88 | * @return ScopePolicy |
||
89 | */ |
||
90 | private function get(string $scopePolicyName): ScopePolicy |
||
98 | |||
99 | /** |
||
100 | * @return ScopePolicy|null |
||
101 | */ |
||
102 | private function default(): ?ScopePolicy |
||
110 | |||
111 | /** |
||
112 | * @param Client $client |
||
113 | * |
||
114 | * @return ScopePolicy|null |
||
115 | */ |
||
116 | private function getForClient(Client $client): ?ScopePolicy |
||
126 | } |
||
127 |