mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-23 00:25:35 +08:00
make commands lazily loaded
This commit is contained in:
20
src/ZM/Command/NonPharLoadModeOnly.php
Normal file
20
src/ZM/Command/NonPharLoadModeOnly.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace ZM\Command;
|
||||
|
||||
trait NonPharLoadModeOnly
|
||||
{
|
||||
protected function shouldExecute(): bool
|
||||
{
|
||||
if (\Phar::running() === '') {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (method_exists($this, 'error')) {
|
||||
$this->error('此命令只能在非 Phar 模式下使用!');
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user