变更
This commit is contained in:
@@ -70,15 +70,6 @@ class Kiri
|
|||||||
return static::$container;
|
return static::$container;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Annotation
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public static function getAnnotation(): Annotation
|
|
||||||
{
|
|
||||||
return static::getDi()->get(Annotation::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $className
|
* @param $className
|
||||||
@@ -308,4 +299,4 @@ class Kiri
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Kiri::setContainer(Container::getInstance());
|
Kiri::setContainer(Container::instance());
|
||||||
|
|||||||
+80
-96
@@ -243,102 +243,86 @@ if (!function_exists('now')) {
|
|||||||
return date('Y-m-d H:i:s') . '.' . str_replace(time() . '.', '', (string)microtime(TRUE));
|
return date('Y-m-d H:i:s') . '.' . str_replace(time() . '.', '', (string)microtime(TRUE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//
|
||||||
|
//
|
||||||
if (!function_exists('Annotation')) {
|
//if (!function_exists('scan_directory')) {
|
||||||
|
//
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* @return Annotation
|
// * @param $dir
|
||||||
* @throws Exception
|
// * @param $namespace
|
||||||
*/
|
// * @param array $exclude
|
||||||
function annotation(): Annotation
|
// * @throws ReflectionException
|
||||||
{
|
// * @throws Exception
|
||||||
return Kiri::getAnnotation();
|
// */
|
||||||
}
|
// function scan_directory($dir, $namespace, array $exclude = []): void
|
||||||
|
// {
|
||||||
|
// $annotation = Kiri::getDi()->get(Annotation::class);
|
||||||
}
|
// $annotation->read($dir, $namespace, $exclude);
|
||||||
|
//
|
||||||
|
// injectRuntime($dir, $exclude);
|
||||||
if (!function_exists('scan_directory')) {
|
// }
|
||||||
|
//
|
||||||
|
//}
|
||||||
/**
|
//
|
||||||
* @param $dir
|
//
|
||||||
* @param $namespace
|
//if (!function_exists('injectRuntime')) {
|
||||||
* @param array $exclude
|
//
|
||||||
* @throws ReflectionException
|
//
|
||||||
* @throws Exception
|
// /**
|
||||||
*/
|
// * @param string $path
|
||||||
function scan_directory($dir, $namespace, array $exclude = []): void
|
// * @param array $exclude
|
||||||
{
|
// * @throws ReflectionException
|
||||||
$annotation = Kiri::getDi()->get(Annotation::class);
|
// * @throws Exception
|
||||||
$annotation->read($dir, $namespace, $exclude);
|
// */
|
||||||
|
// function injectRuntime(string $path, array $exclude = []): void
|
||||||
injectRuntime($dir, $exclude);
|
// {
|
||||||
}
|
// $fileLists = Kiri::getAnnotation()->runtime($path, $exclude);
|
||||||
|
//
|
||||||
}
|
// $router = [];
|
||||||
|
// foreach ($fileLists as $class) {
|
||||||
|
// $target = TargetManager::get($class);
|
||||||
if (!function_exists('injectRuntime')) {
|
// $targetAttributes = $target->getAttributes();
|
||||||
|
// foreach ($targetAttributes as $value) {
|
||||||
|
// $value = $value->newInstance();
|
||||||
/**
|
// if (!method_exists($value, 'execute')) {
|
||||||
* @param string $path
|
// continue;
|
||||||
* @param array $exclude
|
// }
|
||||||
* @throws ReflectionException
|
// $value->execute($class);
|
||||||
* @throws Exception
|
// }
|
||||||
*/
|
//
|
||||||
function injectRuntime(string $path, array $exclude = []): void
|
//
|
||||||
{
|
// $methods = $target->getMethodsAttribute();
|
||||||
$fileLists = Kiri::getAnnotation()->runtime($path, $exclude);
|
// foreach ($methods as $method => $attribute) {
|
||||||
|
// /** @var ReflectionAttribute $item */
|
||||||
$router = [];
|
// foreach ($attribute as $item) {
|
||||||
foreach ($fileLists as $class) {
|
// if (!class_exists($item->getName())) {
|
||||||
$target = TargetManager::get($class);
|
// continue;
|
||||||
$targetAttributes = $target->getAttributes();
|
// }
|
||||||
foreach ($targetAttributes as $value) {
|
// $item = $item->newInstance();
|
||||||
$value = $value->newInstance();
|
// if ($item instanceof Route) {
|
||||||
if (!method_exists($value, 'execute')) {
|
// $router[] = [$item, $class, $method];
|
||||||
continue;
|
// } else {
|
||||||
}
|
// if (!method_exists($item, 'execute')) {
|
||||||
$value->execute($class);
|
// continue;
|
||||||
}
|
// }
|
||||||
|
// $item->execute($class, $method);
|
||||||
|
// }
|
||||||
$methods = $target->getMethodsAttribute();
|
// }
|
||||||
foreach ($methods as $method => $attribute) {
|
// }
|
||||||
/** @var ReflectionAttribute $item */
|
// }
|
||||||
foreach ($attribute as $item) {
|
// if (!empty($router)) {
|
||||||
if (!class_exists($item->getName())) {
|
// foreach ($router as $class) {
|
||||||
continue;
|
// [$item, $class, $method] = $class;
|
||||||
}
|
// if (!method_exists($item, 'execute')) {
|
||||||
$item = $item->newInstance();
|
// continue;
|
||||||
if ($item instanceof Route) {
|
// }
|
||||||
$router[] = [$item, $class, $method];
|
// $item->execute($class, $method);
|
||||||
} else {
|
// }
|
||||||
if (!method_exists($item, 'execute')) {
|
// }
|
||||||
continue;
|
// }
|
||||||
}
|
//
|
||||||
$item->execute($class, $method);
|
//}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!empty($router)) {
|
|
||||||
foreach ($router as $class) {
|
|
||||||
[$item, $class, $method] = $class;
|
|
||||||
if (!method_exists($item, 'execute')) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$item->execute($class, $method);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (!function_exists('directory')) {
|
if (!function_exists('directory')) {
|
||||||
|
|||||||
Reference in New Issue
Block a user