33 lines
745 B
PHP
33 lines
745 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Framework\ErrorHandling\Handlers;
|
|
|
|
/**
|
|
* Result returned by error handlers after processing an exception
|
|
*/
|
|
final readonly class HandlerResult
|
|
{
|
|
public function __construct(
|
|
public bool $handled,
|
|
public string $message,
|
|
public array $data = [],
|
|
public bool $isFinal = false,
|
|
public ?int $statusCode = null
|
|
) {}
|
|
|
|
/**
|
|
* Factory method for creating handler results
|
|
*/
|
|
public static function create(
|
|
bool $handled,
|
|
string $message,
|
|
array $data = [],
|
|
bool $isFinal = false,
|
|
?int $statusCode = null
|
|
): self {
|
|
return new self($handled, $message, $data, $isFinal, $statusCode);
|
|
}
|
|
}
|