This commit is contained in:
2023-07-20 17:12:31 +08:00
parent 0b1be47fb6
commit 2004391c9b
2 changed files with 815 additions and 815 deletions
+4 -4
View File
@@ -12,6 +12,7 @@ use Kiri\Events\EventProvider;
use Kiri\Exception\ConfigException; use Kiri\Exception\ConfigException;
use Kiri\Router\Request; use Kiri\Router\Request;
use Kiri\Router\Response; use Kiri\Router\Response;
use Kiri\Router\Router;
use Psr\Container\ContainerExceptionInterface; use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface; use Psr\Container\NotFoundExceptionInterface;
use Psr\Http\Message\RequestInterface; use Psr\Http\Message\RequestInterface;
@@ -941,7 +942,6 @@ if (!function_exists('config')) {
} }
if (!function_exists('created')) { if (!function_exists('created')) {
/** /**
@@ -953,7 +953,7 @@ if (!function_exists('created')) {
*/ */
function created($key, array $construct = [], array $config = []): ?object function created($key, array $construct = [], array $config = []): ?object
{ {
return Kiri::getDi()->make($key,$construct, $config); return Kiri::getDi()->make($key, $construct, $config);
} }
} }
@@ -1007,7 +1007,7 @@ if (!function_exists('sweep')) {
function sweep(string $configPath = APP_PATH . 'config'): bool|array|string|null function sweep(string $configPath = APP_PATH . 'config'): bool|array|string|null
{ {
$array = []; $array = [];
foreach (glob($configPath . '/*') as $config) { foreach (glob($configPath . '/*.php') as $config) {
$array = array_merge(require "$config", $array); $array = array_merge(require "$config", $array);
} }
return $array; return $array;
@@ -1082,7 +1082,7 @@ if (!function_exists('router')) {
*/ */
function router(): Router function router(): Router
{ {
return Kiri::getDi()->get(Router::class); return Kiri::getDi()->get(Rout::class);
} }
} }
+1 -1
View File
@@ -16,7 +16,7 @@ class ConfigProvider
public function __construct() public function __construct()
{ {
$this->hashMap = new HashMap(); $this->hashMap = new HashMap();
$this->load(sweep(APP_PATH . '/config')); $this->load(sweep(APP_PATH . 'config'));
$this->enableEnvConfig(APP_PATH . '.env'); $this->enableEnvConfig(APP_PATH . '.env');
} }