改名
This commit is contained in:
@@ -65,7 +65,7 @@ class Annotation extends Component
|
|||||||
* @return $this
|
* @return $this
|
||||||
* @throws ReflectionException|NotFindPropertyException|NotFindClassException
|
* @throws ReflectionException|NotFindPropertyException|NotFindClassException
|
||||||
*/
|
*/
|
||||||
public function readControllers(string $path, string $namespace, string $alias = 'root'): static
|
public function read(string $path, string $namespace, string $alias = 'root'): static
|
||||||
{
|
{
|
||||||
return $this->scanDir(glob($path . '*'), $namespace, $alias);
|
return $this->scanDir(glob($path . '*'), $namespace, $alias);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ class DatabasesProviders extends Providers
|
|||||||
public function scanModel()
|
public function scanModel()
|
||||||
{
|
{
|
||||||
$attributes = Snowflake::app()->getAttributes();
|
$attributes = Snowflake::app()->getAttributes();
|
||||||
$attributes->readControllers(MODEL_PATH, 'App\Models', 'models');
|
$attributes->read(MODEL_PATH, 'App\Models', 'models');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+2
-15
@@ -461,20 +461,7 @@ class Server extends HttpService
|
|||||||
$router->loadRouterSetting();
|
$router->loadRouterSetting();
|
||||||
|
|
||||||
$attributes = Snowflake::app()->getAttributes();
|
$attributes = Snowflake::app()->getAttributes();
|
||||||
$attributes->readControllers(CONTROLLER_PATH, 'App\Http\Controllers', 'controllers');
|
$attributes->read(CONTROLLER_PATH, 'App\Http\Controllers', 'controllers');
|
||||||
//
|
|
||||||
// $aliases = $attributes->getAlias('controllers');
|
|
||||||
// if (count($aliases) < 1) {
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// foreach ($aliases as $alias) {
|
|
||||||
// $handler = $alias['handler'];
|
|
||||||
// foreach ($alias['attributes'] as $key => $attribute) {
|
|
||||||
// if ($attribute instanceof IAnnotation) {
|
|
||||||
// $attribute->execute($handler);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -487,7 +474,7 @@ class Server extends HttpService
|
|||||||
$event = Snowflake::app()->getEvent();
|
$event = Snowflake::app()->getEvent();
|
||||||
$event->on(Event::SERVER_WORKER_START, function () {
|
$event->on(Event::SERVER_WORKER_START, function () {
|
||||||
$attributes = Snowflake::app()->getAttributes();
|
$attributes = Snowflake::app()->getAttributes();
|
||||||
$attributes->readControllers(SOCKET_PATH, 'App\Websocket', 'sockets');
|
$attributes->read(SOCKET_PATH, 'App\Websocket', 'sockets');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -136,13 +136,13 @@ class Application extends BaseApplication
|
|||||||
$this->debug('scan system files...');
|
$this->debug('scan system files...');
|
||||||
|
|
||||||
$annotation = Snowflake::app()->getAttributes();
|
$annotation = Snowflake::app()->getAttributes();
|
||||||
$annotation->readControllers(__DIR__ . '/../Console/', 'Console', 'system');
|
$annotation->read(__DIR__ . '/../Console/', 'Console', 'system');
|
||||||
$annotation->readControllers(__DIR__ . '/../Database/', 'Database', 'system');
|
$annotation->read(__DIR__ . '/../Database/', 'Database', 'system');
|
||||||
$annotation->readControllers(__DIR__ . '/../Gii/', 'Gii', 'system');
|
$annotation->read(__DIR__ . '/../Gii/', 'Gii', 'system');
|
||||||
$annotation->readControllers(__DIR__ . '/../HttpServer/', 'HttpServer', 'system');
|
$annotation->read(__DIR__ . '/../HttpServer/', 'HttpServer', 'system');
|
||||||
$annotation->readControllers(__DIR__ . '/../Kafka/', 'Kafka', 'system');
|
$annotation->read(__DIR__ . '/../Kafka/', 'Kafka', 'system');
|
||||||
$annotation->readControllers(__DIR__ . '/../System/', 'Snowflake', 'system');
|
$annotation->read(__DIR__ . '/../System/', 'Snowflake', 'system');
|
||||||
$annotation->readControllers(__DIR__ . '/../Validator/', 'Validator', 'system');
|
$annotation->read(__DIR__ . '/../Validator/', 'Validator', 'system');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user