| Total Complexity | 5 |
| Total Lines | 52 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | class AuthorizationCode |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * @var string |
||
| 16 | */ |
||
| 17 | private $code; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @var string |
||
| 21 | */ |
||
| 22 | private $clientIdentifier; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @var null|string |
||
| 26 | */ |
||
| 27 | private $redirectUri; |
||
| 28 | |||
| 29 | public function __construct(string $code, string $clientIdentifier, ?string $redirectUri = null) |
||
| 30 | { |
||
| 31 | $this->code = $code; |
||
| 32 | $this->clientIdentifier = $clientIdentifier; |
||
| 33 | $this->redirectUri = $redirectUri; |
||
| 34 | } |
||
| 35 | |||
| 36 | public function getClientIdentifier() { |
||
| 37 | return $this->clientIdentifier; |
||
| 38 | } |
||
| 39 | |||
| 40 | /** |
||
| 41 | * @see |
||
| 42 | * |
||
| 43 | * @throws \Exception |
||
| 44 | */ |
||
| 45 | static public function generate() |
||
|
|
|||
| 46 | { |
||
| 47 | return bin2hex(random_bytes(8)); |
||
| 48 | } |
||
| 49 | |||
| 50 | /** |
||
| 51 | * @return null|string |
||
| 52 | */ |
||
| 53 | public function getRedirectUri(): ?string |
||
| 56 | } |
||
| 57 | |||
| 58 | /** |
||
| 59 | * @return string |
||
| 60 | */ |
||
| 61 | public function getCode(): string |
||
| 64 | } |
||
| 65 | } |