crazywhalecc 14bfb4198a
v3 base
2025-11-30 15:35:04 +08:00

47 lines
1.0 KiB
PHP

<?php
declare(strict_types=1);
namespace StaticPHP\Doctor;
class CheckResult
{
public function __construct(private readonly bool $ok, private readonly ?string $message = null, private string $fix_item = '', private array $fix_params = []) {}
public static function fail(string $message, string $fix_item = '', array $fix_params = []): CheckResult
{
return new static(false, $message, $fix_item, $fix_params);
}
public static function ok(?string $message = null): CheckResult
{
return new static(true, $message);
}
public function getMessage(): ?string
{
return $this->message;
}
public function getFixItem(): string
{
return $this->fix_item;
}
public function getFixParams(): array
{
return $this->fix_params;
}
public function isOK(): bool
{
return $this->ok;
}
public function setFixItem(string $fix_item = '', array $fix_params = []): void
{
$this->fix_item = $fix_item;
$this->fix_params = $fix_params;
}
}