Result
Less than 1 minute
Result
Authentication outcome value object.
class Result implements \JsonSerializableEncapsulates the result of an authentication attempt, including whether the attempt succeeded, the resolved identity (if any), optional message text, and arbitrary payload data associated with the auth process.
The object is JSON-serializable for direct use in API responses and other transport layers that need a structured auth result contract.
Properties
success
Indicates whether authentication was successful.
public bool $successidentity
public string $identitytoken
public TokenPair $tokenmessage
Human-readable status or failure message.
public string $messagedata
public array $dataMethods
__construct
public __construct(bool $success, ?string $identity, array $data): voidParameters
| Parameter | Type | Description |
|---|---|---|
$success | bool | Whether authentication was successful |
$identity | string | The authenticated identity (e.g., user ID), or null if authentication failed |
$data | array | Additional data associated with the authentication result |
success
Creates a successful authentication result.
public success(string $identity, array $data): selfParameters
| Parameter | Type | Description |
|---|---|---|
$identity | string | the authenticated user's identity |
$data | array |
failure
Creates a failed authentication result with the provided error message.
public failure(string $message): selfParameters
| Parameter | Type | Description |
|---|---|---|
$message | string | the failure message to associate with the result |
jsonSerialize
Specifies data which should be serialized to JSON.
public jsonSerialize(): voidGenerated by Hazaar API Doc Generator on Tue, 21 Apr 2026 04:00:24 +0000