改名
This commit is contained in:
@@ -373,7 +373,7 @@ abstract class BaseApplication extends Component
|
|||||||
*/
|
*/
|
||||||
public function getRouter(): Router
|
public function getRouter(): Router
|
||||||
{
|
{
|
||||||
return $this->get('router');
|
return Kiri::getDi()->get(Router::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -467,7 +467,6 @@ abstract class BaseApplication extends Component
|
|||||||
'config' => ['class' => Config::class],
|
'config' => ['class' => Config::class],
|
||||||
'logger' => ['class' => Logger::class],
|
'logger' => ['class' => Logger::class],
|
||||||
'annotation' => ['class' => SAnnotation::class],
|
'annotation' => ['class' => SAnnotation::class],
|
||||||
'router' => ['class' => Router::class],
|
|
||||||
'redis' => ['class' => Redis::class],
|
'redis' => ['class' => Redis::class],
|
||||||
'databases' => ['class' => Connection::class],
|
'databases' => ['class' => Connection::class],
|
||||||
'aop' => ['class' => AspectManager::class],
|
'aop' => ['class' => AspectManager::class],
|
||||||
|
|||||||
+1
-3
@@ -1006,7 +1006,7 @@ if (!function_exists('router')) {
|
|||||||
*/
|
*/
|
||||||
function router(): Router
|
function router(): Router
|
||||||
{
|
{
|
||||||
return Kiri::app()->getRouter();
|
return Kiri::getDi()->get(Router::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1018,8 +1018,6 @@ if (!function_exists('isService')) {
|
|||||||
/**
|
/**
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @return bool
|
* @return bool
|
||||||
* @throws NotFindClassException
|
|
||||||
* @throws ReflectionException
|
|
||||||
*/
|
*/
|
||||||
function isService(string $name): bool
|
function isService(string $name): bool
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ class Router extends HttpService implements RouterInterface
|
|||||||
*/
|
*/
|
||||||
public static function getNamespace(): string
|
public static function getNamespace(): string
|
||||||
{
|
{
|
||||||
$router = Kiri::app()->getRouter();
|
$router = Kiri::getDi()->get(Router::class);
|
||||||
|
|
||||||
return Config::get('http.namespace', $router->namespace);
|
return Config::get('http.namespace', $router->namespace);
|
||||||
}
|
}
|
||||||
@@ -96,7 +96,7 @@ class Router extends HttpService implements RouterInterface
|
|||||||
* @param $handler
|
* @param $handler
|
||||||
* @param string $method
|
* @param string $method
|
||||||
* @return ?Node
|
* @return ?Node
|
||||||
* @throws Exception
|
* @throws
|
||||||
*/
|
*/
|
||||||
public function addRoute($path, $handler, string $method = 'any'): ?Node
|
public function addRoute($path, $handler, string $method = 'any'): ?Node
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ class OnWorkerStart implements EventDispatcherInterface
|
|||||||
$this->interpretDirectory($isWorker);
|
$this->interpretDirectory($isWorker);
|
||||||
if ($isWorker) {
|
if ($isWorker) {
|
||||||
ServerManager::setEnv('environmental', Kiri::WORKER);
|
ServerManager::setEnv('environmental', Kiri::WORKER);
|
||||||
Kiri::getFactory()->getRouter()->_loader();
|
Kiri::getDi()->get(Router::class)->_loader();
|
||||||
|
|
||||||
$this->setProcessName(sprintf('Worker[%d].%d', $event->server->worker_pid, $event->workerId));
|
$this->setProcessName(sprintf('Worker[%d].%d', $event->server->worker_pid, $event->workerId));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -23,18 +23,15 @@ use Kiri\Kiri;
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param static $params
|
* @param mixed $class
|
||||||
* @param mixed $class
|
* @param mixed|null $method
|
||||||
* @param mixed|null $method
|
* @return Router
|
||||||
* @return Router
|
*/
|
||||||
* @throws \Kiri\Exception\NotFindClassException
|
|
||||||
* @throws \ReflectionException
|
|
||||||
*/
|
|
||||||
public function execute(mixed $class, mixed $method = null): Router
|
public function execute(mixed $class, mixed $method = null): Router
|
||||||
{
|
{
|
||||||
// TODO: Implement setHandler() method.
|
// TODO: Implement setHandler() method.
|
||||||
$router = Kiri::app()->getRouter();
|
$router = Kiri::getDi()->get(Router::class);
|
||||||
if (is_string($class)) {
|
if (is_string($class)) {
|
||||||
$class = di($class);
|
$class = di($class);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user