mirror of
https://github.com/AnimeThemes/animethemes-server.git
synced 2026-11-12 09:08:49 +01:00
54 lines
951 B
PHP
54 lines
951 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Actions;
|
|
|
|
use App\Enums\Actions\ActionStatus;
|
|
|
|
/**
|
|
* Class ActionResult.
|
|
*/
|
|
class ActionResult
|
|
{
|
|
/**
|
|
* Create a new action result instance.
|
|
*
|
|
* @param ActionStatus $status
|
|
* @param string|null $message
|
|
*/
|
|
public function __construct(protected readonly ActionStatus $status, protected readonly ?string $message = null)
|
|
{
|
|
}
|
|
|
|
/**
|
|
* Get the action result status.
|
|
*
|
|
* @return ActionStatus
|
|
*/
|
|
public function getStatus(): ActionStatus
|
|
{
|
|
return $this->status;
|
|
}
|
|
|
|
/**
|
|
* Get the action result message.
|
|
*
|
|
* @return string|null
|
|
*/
|
|
public function getMessage(): ?string
|
|
{
|
|
return $this->message;
|
|
}
|
|
|
|
/**
|
|
* Has the action failed?
|
|
*
|
|
* @return bool
|
|
*/
|
|
public function hasFailed(): bool
|
|
{
|
|
return ActionStatus::FAILED()->is($this->status);
|
|
}
|
|
}
|