class AccessToken implements ScopeAuthorizable, Arrayable, Jsonable, JsonSerializable, Transient mixin Token

Traits

Properties

protected Token|null $token

The token instance.

protected TValue> $attributes

All the attributes set on the access token instance.

string $oauth_access_token_id
string $oauth_client_id
list<string> $oauth_audiences
string $oauth_user_id
string[] $oauth_scopes

Methods

bool
scopeExistsIn(string $scope, array $haystack)

Determine if a scope exists or is inherited in the given array.

array
resolveInheritedScopes(string $scope)

Resolve all possible scopes.

mixed
forwardCallTo(mixed $object, string $method, array $parameters)

Forward a method call to the given object.

mixed
forwardDecoratedCallTo(mixed $object, string $method, array $parameters)

Forward a method call to the given object, returning $this if the forwarded call returned itself.

static never
throwBadMethodCallException(string $method)

Throw a bad method call exception for the given method.

__construct(array $attributes = [])

Create a new access token instance.

static AccessToken
fromPsrRequest(ServerRequestInterface $request)

Create a new access token instance from the incoming PSR-7 request.

bool
can(string $scope)

Determine if the token has a given scope.

bool
cant(string $scope)

Determine if the token is missing a given scope.

bool
transient()

Determine if the token is a transient JWT token.

bool
revoke()

Revoke the token instance.

Token|null
getToken()

Get the token instance.

array
toArray()

Convert the access token instance to an array.

array
jsonSerialize()

Convert the object into something JSON serializable.

string
toJson(int $options = 0)

Convert the access token instance to JSON.

bool
__isset(string $key)

Dynamically determine if an attribute is set.

mixed
__get(string $key)

Dynamically retrieve the value of an attribute.

mixed
__call(string $method, array $parameters)

Pass dynamic methods onto the token instance.

Details

protected bool scopeExistsIn(string $scope, array $haystack)

Determine if a scope exists or is inherited in the given array.

Parameters

string $scope
array $haystack

Return Value

bool

protected array resolveInheritedScopes(string $scope)

Resolve all possible scopes.

Parameters

string $scope

Return Value

array

in ForwardsCalls at line 22
protected mixed forwardCallTo(mixed $object, string $method, array $parameters)

Forward a method call to the given object.

Parameters

mixed $object
string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

in ForwardsCalls at line 52
protected mixed forwardDecoratedCallTo(mixed $object, string $method, array $parameters)

Forward a method call to the given object, returning $this if the forwarded call returned itself.

Parameters

mixed $object
string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

in ForwardsCalls at line 66
static protected never throwBadMethodCallException(string $method)

Throw a bad method call exception for the given method.

Parameters

string $method

Return Value

never

Exceptions

BadMethodCallException

at line 52
__construct(array $attributes = [])

Create a new access token instance.

Parameters

array $attributes

at line 62
static AccessToken fromPsrRequest(ServerRequestInterface $request)

Create a new access token instance from the incoming PSR-7 request.

Parameters

ServerRequestInterface $request

Return Value

AccessToken

at line 70
bool can(string $scope)

Determine if the token has a given scope.

Parameters

string $scope

Return Value

bool

at line 83
bool cant(string $scope)

Determine if the token is missing a given scope.

Parameters

string $scope

Return Value

bool

at line 91
bool transient()

Determine if the token is a transient JWT token.

Return Value

bool

at line 99
bool revoke()

Revoke the token instance.

Return Value

bool

at line 128
protected Token|null getToken()

Get the token instance.

Return Value

Token|null

at line 143
array toArray()

Convert the access token instance to an array.

Return Value

array

at line 153
array jsonSerialize()

Convert the object into something JSON serializable.

Return Value

array

at line 161
string toJson(int $options = 0)

Convert the access token instance to JSON.

Parameters

int $options

Return Value

string

at line 169
bool __isset(string $key)

Dynamically determine if an attribute is set.

Parameters

string $key

Return Value

bool

at line 177
mixed __get(string $key)

Dynamically retrieve the value of an attribute.

Parameters

string $key

Return Value

mixed

at line 189
mixed __call(string $method, array $parameters)

Pass dynamic methods onto the token instance.

Parameters

string $method
array $parameters

Return Value

mixed