同步更新
This commit is contained in:
32
src/think/console/command/CommandCallable.php
Normal file
32
src/think/console/command/CommandCallable.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2006~2025 http://thinkphp.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: yunwuxin <448901948@qq.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace think\console\command;
|
||||
|
||||
use think\console\Command;
|
||||
use think\console\Input;
|
||||
|
||||
/**
|
||||
* @mixin Command
|
||||
*/
|
||||
trait CommandCallable
|
||||
{
|
||||
/**
|
||||
* @param class-string<Command> $class
|
||||
*/
|
||||
private function callCommand(string $class): Command
|
||||
{
|
||||
return tap(app($class, newInstance: true), function ($command) {
|
||||
$command->setApp($this->app);
|
||||
$command->run(new Input([]), clone $this->output);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user