hyperf-view/builder/Command.php

63 lines
1.7 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 Command
* @package System
*/
abstract class Command 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 -----------------\
| _____ _ __ ___ |
| |_ _| | __ \ \ / (_) _____ __ |
| | | | |/ / \ \ / /| |/ _ \ \ /\ / / |
| | | | < \ V / | | __/\ V V / |
| |_| |_|\_\ \_/ |_|\___| \_/\_/ |
| |
\-------- Copyright ZoomTk 2023 ~ %s ----------
', date('Y', strtotime('20 year')));
}
}