hyperf-view/builder/MineCommand.php

63 lines
1.8 KiB
PHP

<?php
/**
* MineAdmin is committed to providing solutions for quickly building web applications
* Please view the LICENSE file that was distributed with this source code,
* For the full copyright and license information.
* Thank you very much for using MineAdmin.
*
* @Author X.Mo<root@imoi.cn>
* @Link https://gitee.com/xmo/MineAdmin
*/
declare(strict_types=1);
namespace Builder;
use Hyperf\Command\Command as HyperfCommand;
/**
* Class MineCommand
* @package System
*/
abstract class MineCommand extends HyperfCommand
{
protected string $module;
protected CONST CONSOLE_GREEN_BEGIN = "\033[32;5;1m";
protected CONST CONSOLE_RED_BEGIN = "\033[31;5;1m";
protected CONST CONSOLE_END = "\033[0m";
protected function getGreenText($text): string
{
return self::CONSOLE_GREEN_BEGIN . $text . self::CONSOLE_END;
}
protected function getRedText($text): string
{
return self::CONSOLE_RED_BEGIN . $text . self::CONSOLE_END;
}
protected function getStub($filename): string
{
return BASE_PATH . '/mine/Command/Creater/Stubs/' . $filename . '.stub';
}
protected function getModulePath(): string
{
return BASE_PATH . '/app/' . $this->module . '/Request/';
}
protected function getInfo(): string
{
return sprintf('
/---------------------- welcome to use -----------------------\
| _ ___ __ _ |
| ____ ___ (_)___ _____ / | ____/ /___ ___ (_)___ |
| / __ `__ \/ / __ \/ ___/ / /| |/ __ / __ `__ \/ / __ \ |
| / / / / / / / / / / /__/ / ___ / /_/ / / / / / / / / / / |
| /_/ /_/ /_/_/_/ /_/\___/ /_/ |_\__,_/_/ /_/ /_/_/_/ /_/ |
| |
\_____________ Copyright MineAdmin 2021 ~ %s _____________|
', date('Y'));
}
}