| Total Complexity | 3 |
| Total Lines | 35 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | class AuthorizationStorage |
||
| 10 | { |
||
| 11 | protected $data; |
||
| 12 | |||
| 13 | /** |
||
| 14 | * @param AuthorizationCredentials $credentials |
||
| 15 | * |
||
| 16 | * @return string|null |
||
| 17 | */ |
||
| 18 | 1 | protected function transformCredentialsToKey(AuthorizationCredentials $credentials): ?string |
|
| 19 | { |
||
| 20 | 1 | return sprintf('%s_%s', $credentials->getApplicationId(), $credentials->getAppKey()); |
|
| 21 | } |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @param AuthorizationCredentials $credentials |
||
| 25 | * |
||
| 26 | * @return string|null |
||
| 27 | */ |
||
| 28 | 1 | public function fetch(AuthorizationCredentials $credentials): ?string |
|
| 29 | { |
||
| 30 | 1 | $key = $this->transformCredentialsToKey($credentials); |
|
| 31 | |||
| 32 | 1 | return $this->data[$key] ?? null; |
|
| 33 | } |
||
| 34 | |||
| 35 | /** |
||
| 36 | * @param AuthorizationCredentials $credentials |
||
| 37 | * @param string $accessToken |
||
| 38 | */ |
||
| 39 | 1 | public function save(AuthorizationCredentials $credentials, string $accessToken): void |
|
| 44 | 1 | } |
|
| 45 | } |
||
| 46 |