modify plugin name

This commit is contained in:
2022-02-25 18:00:55 +08:00
parent ecddacb321
commit a71924dd37
+22 -20
View File
@@ -13,13 +13,12 @@ namespace Kiri\Abstracts;
use Exception;
use Kiri;
use Kiri\Di\LocalService;
use Kiri\Error\{ErrorHandler, StdoutLoggerInterface, StdoutLogger};
use Kiri\Exception\{InitException, NotFindClassException};
use Kiri\Error\{ErrorHandler, StdoutLogger, StdoutLoggerInterface};
use Kiri\Exception\{InitException};
use Kiri\Server\{Server};
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use Kiri\Server\{Server};
use Psr\Log\LoggerInterface;
use ReflectionException;
/**
* Class BaseApplication
@@ -178,7 +177,6 @@ abstract class BaseApplication extends Component
}
/**
* @param $key
* @param $value
@@ -237,7 +235,7 @@ abstract class BaseApplication extends Component
*/
public function initErrorHandler()
{
$error = $this->container->get(ErrorHandler::class);
$error = Kiri::getDi()->get(ErrorHandler::class);
$error->register();
}
@@ -249,7 +247,7 @@ abstract class BaseApplication extends Component
*/
public function get($name): mixed
{
return $this->container->get(LocalService::class)->get($name);
return Kiri::getDi()->get(LocalService::class)->get($name);
}
@@ -272,17 +270,7 @@ abstract class BaseApplication extends Component
/**
* @return Logger
* @throws
*/
public function getLogger(): Logger
{
return $this->get('logger');
}
/**
*
* @return Server
* @throws
*/
@@ -292,6 +280,20 @@ abstract class BaseApplication extends Component
}
/**
* @param string $name
* @return mixed|null
* @throws Exception
*/
public function __get(string $name)
{
$localService = Kiri::getDi()->get(LocalService::class);
if ($localService->has($name)) {
return $localService->get($name);
}
return parent::__get($name); // TODO: Change the autogenerated stub
}
/**
* @param $id
@@ -299,7 +301,7 @@ abstract class BaseApplication extends Component
*/
public function set($id, $definition): void
{
$this->container->get(LocalService::class)->set($id, $definition);
Kiri::getDi()->get(LocalService::class)->set($id, $definition);
}
@@ -309,6 +311,6 @@ abstract class BaseApplication extends Component
*/
public function has($id): bool
{
return $this->container->get(LocalService::class)->has($id);
return Kiri::getDi()->get(LocalService::class)->has($id);
}
}