BiliHelper-personal/src/Bootstrap/Bootstrap.php
2024-12-31 11:17:17 +08:00

106 lines
2.6 KiB
PHP
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php declare(strict_types=1);
/**
* Website: https://mudew.com/
* Author: Lkeme
* License: The MIT License
* Email: Useri@live.cn
* Updated: 2018 ~ 2026
*
* _____ _ _ _ _ _ _____ _ _____ _____ _____
* | _ \ | | | | | | | | | | | ____| | | | _ \ | ____| | _ \ & l、
* | |_| | | | | | | | | |_| | | |__ | | | |_| | | |__ | |_| | (゚、 。
* | _ { | | | | | | | _ | | __| | | | ___/ | __| | _ /   \、゙ ~ヽ *
* | |_| | | | | |___ | | | | | | | |___ | |___ | | | |___ | | \ \  じしf_, )
* |_____/ |_| |_____| |_| |_| |_| |_____| |_____| |_| |_____| |_| \_\
*/
namespace Bhp\Bootstrap;
use Bhp\Cache\Cache;
use Bhp\Console\Console;
use Bhp\Core\Core;
use Bhp\Device\Device;
use Bhp\FilterWords\FilterWords;
use Bhp\Log\Log;
use Bhp\Notice\Notice;
use Bhp\Plugin\Plugin;
use Bhp\Request\Request;
use Bhp\Schedule\Schedule;
use Bhp\Sign\Sign;
use Bhp\Task\Task;
use Bhp\TimeLock\TimeLock;
use Bhp\User\User;
use Bhp\Util\DesignPattern\SingleTon;
use Bhp\Env\Env;
use Bhp\Config\Config;
class Bootstrap extends SingleTon
{
/**
* @var string
*/
protected string $global_path;
/**
* @var string
*/
protected string $profile_name;
/**
* @param string $global_path
* @param array $argv
* @return void
*/
public function init(string $global_path, array $argv): void
{
$this->global_path = $global_path;
$this->profile_name = Console::parse($argv);
$this->superRegister();
}
public function superRegister(): void
{
// 核心
Core::getInstance($this->global_path, $this->profile_name);
// 环境
Env::getInstance();
// 排程
Schedule::getInstance();
// 插件中心
Plugin::getInstance();
// 配置
Config::getInstance();
// 缓存中心
Cache::getInstance();
// 日志
Log::getInstance();
// 设备/取前缀
Device::getInstance();
// 请求中心
Request::getInstance();
// 时间锁
TimeLock::getInstance();
// 过滤词
FilterWords::getInstance();
// 签名
Sign::getInstance();
// 用户
User::getInstance();
// 通知中心
Notice::getInstance();
// 任务中心
Task::getInstance();
// 控制台
Console::getInstance();
}
/**
* @return void
*/
public function run(): void
{
Console::getInstance()->register();
}
}