BaseHandler
in package
AbstractYes
Table of Contents
Properties
- $baseUrl : string
- $client : Client
- $credentialService : LastFmCredentialService|null
- $sessionKey : string|null
Methods
- __construct() : mixed
- setCredentialService() : void
- Set the credential service for automatic session management
- setSessionKey() : void
- Manually set session key (overrides automatic detection)
- buildQueryParams() : array<string|int, mixed>
- Build query parameters with automatic session key injection
- getSessionKey() : string|null
- Get session key for authenticated requests
- hasValidCredentials() : bool
- Check if current user has valid credentials
- makeRequest() : array<string|int, mixed>
- Make synchronous API request with error handling
- makeRequestAsync() : PromiseInterface
- Make asynchronous API request returning a promise
- requireAuthentication() : bool
- Require authenticated session for the request
Properties
$baseUrl read-only
protected
string
$baseUrl
$client read-only
protected
Client
$client
$credentialService
protected
LastFmCredentialService|null
$credentialService
= null
$sessionKey
protected
string|null
$sessionKey
= null
Methods
__construct()
public
__construct(Client $client, string $baseUrl) : mixed
Parameters
- $client : Client
- $baseUrl : string
setCredentialService()
Set the credential service for automatic session management
public
setCredentialService(LastFmCredentialService $credentialService) : void
Parameters
- $credentialService : LastFmCredentialService
setSessionKey()
Manually set session key (overrides automatic detection)
public
setSessionKey(string|null $sessionKey) : void
Parameters
- $sessionKey : string|null
buildQueryParams()
Build query parameters with automatic session key injection
protected
buildQueryParams(array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
- $params : array<string|int, mixed>
Return values
array<string|int, mixed>getSessionKey()
Get session key for authenticated requests
protected
getSessionKey() : string|null
Return values
string|nullhasValidCredentials()
Check if current user has valid credentials
protected
hasValidCredentials() : bool
Return values
boolmakeRequest()
Make synchronous API request with error handling
protected
makeRequest(array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
- $params : array<string|int, mixed>
Return values
array<string|int, mixed>makeRequestAsync()
Make asynchronous API request returning a promise
protected
makeRequestAsync(array<string|int, mixed> $params) : PromiseInterface
Parameters
- $params : array<string|int, mixed>
Return values
PromiseInterfacerequireAuthentication()
Require authenticated session for the request
protected
requireAuthentication() : bool