This commit is contained in:
2023-12-12 10:56:44 +08:00
parent 2add68b33a
commit dc4b2ec8ca
5 changed files with 13 additions and 15 deletions
@@ -12,7 +12,6 @@ namespace Kiri\Abstracts;
use Database\DatabasesProviders; use Database\DatabasesProviders;
use Exception; use Exception;
use Kiri;
use Kiri\Events\EventInterface; use Kiri\Events\EventInterface;
use Kiri\Config\ConfigProvider; use Kiri\Config\ConfigProvider;
use Kiri\Exception\{InitException}; use Kiri\Exception\{InitException};
+8 -9
View File
@@ -27,6 +27,7 @@ use Symfony\Component\Console\{Application as ConsoleApplication,
}; };
use Kiri\Server\ServerCommand; use Kiri\Server\ServerCommand;
use Kiri\Di\Inject\Container; use Kiri\Di\Inject\Container;
use function config;
/** /**
* Class Init * Class Init
@@ -58,10 +59,10 @@ class Application extends BaseApplication
*/ */
public function init(): void public function init(): void
{ {
$this->errorHandler->registerShutdownHandler(\config('error.shutdown', [])); $this->errorHandler->registerShutdownHandler(config('error.shutdown', []));
$this->errorHandler->registerExceptionHandler(\config('error.exception', [])); $this->errorHandler->registerExceptionHandler(config('error.exception', []));
$this->errorHandler->registerErrorHandler(\config('error.error', [])); $this->errorHandler->registerErrorHandler(config('error.error', []));
$this->id = \config('id', uniqid('id.')); $this->id = config('id', uniqid('id.'));
$this->provider->on(OnBeforeCommandExecute::class, [$this, 'beforeCommandExecute']); $this->provider->on(OnBeforeCommandExecute::class, [$this, 'beforeCommandExecute']);
} }
@@ -78,12 +79,10 @@ class Application extends BaseApplication
{ {
if (!($beforeCommandExecute->command instanceof ServerCommand)) { if (!($beforeCommandExecute->command instanceof ServerCommand)) {
$scanner = $this->container->get(Scanner::class); $scanner = $this->container->get(Scanner::class);
$scanner->read(APP_PATH . 'app/'); $scanner->load_directory(APP_PATH . 'app/');
$scanner->parse('App'); } else if (config('reload.hot', false) === false) {
} else if (\config('reload.hot', false) === false) {
$scanner = $this->container->get(Scanner::class); $scanner = $this->container->get(Scanner::class);
$scanner->read(APP_PATH . 'app/'); $scanner->load_directory(APP_PATH . 'app/');
$scanner->parse('App');
} }
} }
-1
View File
@@ -8,7 +8,6 @@ namespace Kiri;
use JetBrains\PhpStorm\Pure; use JetBrains\PhpStorm\Pure;
use Kiri;
/** /**
* Class Environmental * Class Environmental
-1
View File
@@ -12,7 +12,6 @@ namespace Kiri\Error;
use Closure; use Closure;
use ErrorException; use ErrorException;
use Exception; use Exception;
use Kiri;
use Kiri\Abstracts\Component; use Kiri\Abstracts\Component;
use Psr\Container\ContainerInterface; use Psr\Container\ContainerInterface;
use Kiri\Di\Inject\Container; use Kiri\Di\Inject\Container;
+5 -3
View File
@@ -13,7 +13,8 @@ use Exception;
use Kiri; use Kiri;
use Kiri\Exception\RedisConnectException; use Kiri\Exception\RedisConnectException;
use Kiri\Pool\Pool; use Kiri\Pool\Pool;
use function println; use RedisException;
use function config;
/** /**
* Class Redis * Class Redis
@@ -52,7 +53,7 @@ class Redis
*/ */
public function __construct() public function __construct()
{ {
Kiri::configure($this, \config('redis', [])); Kiri::configure($this, config('redis', []));
} }
/** /**
@@ -84,6 +85,7 @@ class Redis
* @param $key * @param $key
* @param int $timeout * @param int $timeout
* @return bool * @return bool
* @throws RedisException
*/ */
public function waite($key, int $timeout = 5): bool public function waite($key, int $timeout = 5): bool
{ {
@@ -187,7 +189,7 @@ SCRIPT;
/** /**
* @return \Redis * @return \Redis
* @throws RedisConnectException * @throws RedisConnectException|RedisException
*/ */
protected function connect(): \Redis protected function connect(): \Redis
{ {