mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 21:04:52 +08:00
43 lines
829 B
PHP
43 lines
829 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
declare(strict_types=1);
|
||
|
|
|
||
|
|
namespace SPC\doctor;
|
||
|
|
|
||
|
|
class CheckResult
|
||
|
|
{
|
||
|
|
public function __construct(private string $message = '', private string $fix_item = '', private array $fix_params = [])
|
||
|
|
{
|
||
|
|
}
|
||
|
|
|
||
|
|
public static function fail(string $message, string $fix_item = '', array $fix_params = []): CheckResult
|
||
|
|
{
|
||
|
|
return new static($message, $fix_item, $fix_params);
|
||
|
|
}
|
||
|
|
|
||
|
|
public static function ok(): CheckResult
|
||
|
|
{
|
||
|
|
return new static();
|
||
|
|
}
|
||
|
|
|
||
|
|
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 empty($this->message);
|
||
|
|
}
|
||
|
|
}
|