| Total Complexity | 4 |
| Total Lines | 35 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | class GrantContext |
||
| 14 | { |
||
| 15 | |||
| 16 | /** @var array<IGrant> */ |
||
| 17 | private array $grantTypes = []; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * Add grant type |
||
| 21 | */ |
||
| 22 | public function addGrantType(IGrant $grantType): void |
||
| 23 | { |
||
| 24 | $this->grantTypes[$grantType->getIdentifier()] = $grantType; |
||
| 25 | } |
||
| 26 | |||
| 27 | /** |
||
| 28 | * Remove grant type from strategy context |
||
| 29 | * @param string $grantType |
||
| 30 | */ |
||
| 31 | public function removeGrantType(string $grantType): void |
||
| 32 | { |
||
| 33 | unset($this->grantTypes[$grantType]); |
||
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * Get grant type |
||
| 38 | * @param string $grantType |
||
| 39 | * @throws InvalidStateException |
||
| 40 | * @return IGrant |
||
| 41 | */ |
||
| 42 | public function getGrantType(string $grantType): IGrant |
||
| 48 | } |
||
| 49 | } |
||
| 50 |