for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Parroauth2\Client\EndPoint\Authorization;
/**
* Wrap the authorization response for a response_type=code
*
* @see https://tools.ietf.org/html/rfc6749#section-4.1.2
* @psalm-immutable
*/
class AuthorizationCodeResponse
{
* @var array<string, mixed>
private $parameters;
* AuthorizationCodeResponse constructor.
* @param array<string, mixed> $parameters
public function __construct(array $parameters)
$this->parameters = $parameters;
}
* Get the authorization code
* @return string
public function code(): string
return $this->parameters['code'];
* Get the state
public function state(): string
return $this->parameters['state'] ?? '';
* Check if the response is an error response
* @return bool
public function isError(): bool
return isset($this->parameters['error']);
* Get the error code
public function error(): string
return $this->parameters['error'];
* Get the human readable error message
* @return string|null
public function errorDescription(): ?string
return $this->parameters['error_description'] ?? null;