refactor all base things

This commit is contained in:
crazywhalecc
2022-08-13 17:00:29 +08:00
committed by Jerry Ma
parent 1c801bb205
commit b2c95d96b1
54 changed files with 3009 additions and 383 deletions

View File

@@ -0,0 +1,35 @@
<?php
declare(strict_types=1);
namespace ZM;
use Exception;
use ZM\Exception\InitException;
use ZM\Plugin\InstantPlugin;
class InstantApplication extends InstantPlugin
{
private static $obj;
/**
* @param null|mixed $dir
* @throws InitException
*/
public function __construct($dir = null)
{
if (self::$obj !== null) {
throw new InitException(zm_internal_errcode('E00069') . 'Initializing another Application is not allowed!');
}
self::$obj = $this; // 用于标记已经初始化完成
parent::__construct($dir ?? __DIR__);
}
/**
* @throws Exception
*/
public function run()
{
(new Framework())->init()->start();
}
}