mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 12:54:52 +08:00
Add registry availability check
This commit is contained in:
parent
0be4e859f3
commit
753fdd725e
23
src/StaticPHP/Doctor/Item/RegistryCheck.php
Normal file
23
src/StaticPHP/Doctor/Item/RegistryCheck.php
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace StaticPHP\Doctor\Item;
|
||||||
|
|
||||||
|
use StaticPHP\Attribute\Doctor\CheckItem;
|
||||||
|
use StaticPHP\Doctor\CheckResult;
|
||||||
|
use StaticPHP\Registry\Registry;
|
||||||
|
use ZM\Logger\ConsoleColor;
|
||||||
|
|
||||||
|
class RegistryCheck
|
||||||
|
{
|
||||||
|
#[CheckItem('if at least one registry is configured', level: 99999)]
|
||||||
|
public function checkRegistry(): ?CheckResult
|
||||||
|
{
|
||||||
|
$regs = Registry::getLoadedRegistries();
|
||||||
|
if (count($regs) > 0) {
|
||||||
|
return CheckResult::ok(implode(',', array_map(fn ($x) => ConsoleColor::green($x), $regs)));
|
||||||
|
}
|
||||||
|
return CheckResult::fail('No registry configured');
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user