mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-09 01:45:36 +08:00
v3 base
This commit is contained in:
46
src/StaticPHP/Doctor/CheckResult.php
Normal file
46
src/StaticPHP/Doctor/CheckResult.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user