This commit is contained in:
2020-09-15 19:26:44 +08:00
parent f27cec805d
commit 480abf2d28
2 changed files with 43 additions and 0 deletions
+22
View File
@@ -38,6 +38,17 @@ class Application extends BaseApplication
public $id = 'uniqueId';
/**
* Application constructor.
* @param array $config
*/
public function __construct(array $config = [])
{
$this->scanning();
parent::__construct($config);
}
/**
* @throws ConfigException
* @throws NotFindClassException
@@ -109,6 +120,17 @@ class Application extends BaseApplication
}
/**
*
*/
private function scanning()
{
$this->debug('start scanning...');
loadByDir(__DIR__ . '/../');
$this->debug('scanning end...');
}
/**
* @param $className
* @param null $abstracts
+21
View File
@@ -32,6 +32,27 @@ if (!function_exists('make')) {
}
}
if (!function_exists('loadByDir')) {
/**
* @param $path
*/
function loadByDir($path)
{
$path = rtrim($path, '/');
foreach (glob($path . '/*') as $value) {
if (is_dir($value)) {
loadByDir($value);
}else{
include_once "$value";
}
}
}
}