diff --git a/docs/.vuepress/api.js b/docs/.vuepress/api.js index a360f8f6..b8ffaba6 100644 --- a/docs/.vuepress/api.js +++ b/docs/.vuepress/api.js @@ -1 +1 @@ -module.exports = [{"title":"ZM","collapsable":true,"children":["ZM/ConsoleApplication","ZM/ZMServer","ZM/Framework"]},{"title":"ZM/API","collapsable":true,"children":["ZM/API/OneBotV11","ZM/API/GoCqhttpAPIV11","ZM/API/ZMRobot","ZM/API/CQ","ZM/API/TuringAPI"]},{"title":"ZM/API/Proxies/Bot","collapsable":true,"children":["ZM/API/Proxies/Bot/AllGroupsProxy","ZM/API/Proxies/Bot/AllBotsProxy","ZM/API/Proxies/Bot/AbstractBotProxy"]},{"title":"ZM/Annotation","collapsable":true,"children":["ZM/Annotation/AnnotationParser"]},{"title":"ZM/Annotation/Swoole","collapsable":true,"children":["ZM/Annotation/Swoole/OnSwooleEventBase"]},{"title":"ZM/Command","collapsable":true,"children":["ZM/Command/CheckConfigCommand"]},{"title":"ZM/Command/Module","collapsable":true,"children":["ZM/Command/Module/ModulePackCommand","ZM/Command/Module/ModuleListCommand"]},{"title":"ZM/Context","collapsable":true,"children":["ZM/Context/Context"]},{"title":"ZM/DB","collapsable":true,"children":["ZM/DB/UpdateBody","ZM/DB/DeleteBody","ZM/DB/DB","ZM/DB/SelectBody","ZM/DB/InsertBody","ZM/DB/Table"]},{"title":"ZM/Event","collapsable":true,"children":["ZM/Event/EventDispatcher","ZM/Event/EventManager","ZM/Event/EventTracer"]},{"title":"ZM/Event/SwooleEvent","collapsable":true,"children":["ZM/Event/SwooleEvent/OnTask","ZM/Event/SwooleEvent/OnWorkerStart"]},{"title":"ZM/Http","collapsable":true,"children":["ZM/Http/Response"]},{"title":"ZM/Module","collapsable":true,"children":["ZM/Module/ModuleUnpacker","ZM/Module/QQBot","ZM/Module/ModuleBase","ZM/Module/ModulePacker"]},{"title":"ZM/MySQL","collapsable":true,"children":["ZM/MySQL/MySQLStatement","ZM/MySQL/MySQLPool","ZM/MySQL/MySQLQueryBuilder","ZM/MySQL/MySQLConnection","ZM/MySQL/MySQLWrapper","ZM/MySQL/MySQLStatementWrapper"]},{"title":"ZM/Store","collapsable":true,"children":["ZM/Store/LightCacheInside","ZM/Store/ZMAtomic","ZM/Store/LightCache"]},{"title":"ZM/Store/Redis","collapsable":true,"children":["ZM/Store/Redis/ZMRedis"]},{"title":"ZM/Utils","collapsable":true,"children":["ZM/Utils/Terminal","ZM/Utils/ZMUtil","ZM/Utils/SignalListener","ZM/Utils/CoMessage","ZM/Utils/MessageUtil","ZM/Utils/DataProvider","ZM/Utils/HttpUtil"]},{"title":"ZM/Utils/Manager","collapsable":true,"children":["ZM/Utils/Manager/CronManager","ZM/Utils/Manager/ModuleManager","ZM/Utils/Manager/WorkerManager"]}] \ No newline at end of file +module.exports = [{"title":"ZM","collapsable":true,"children":["ZM/ConsoleApplication","ZM/ZMServer","ZM/Framework"]},{"title":"ZM/API","collapsable":true,"children":["ZM/API/OneBotV11","ZM/API/GoCqhttpAPIV11","ZM/API/ZMRobot","ZM/API/CQ","ZM/API/TuringAPI"]},{"title":"ZM/API/Proxies/Bot","collapsable":true,"children":["ZM/API/Proxies/Bot/AllGroupsProxy","ZM/API/Proxies/Bot/AllBotsProxy","ZM/API/Proxies/Bot/AbstractBotProxy"]},{"title":"ZM/Annotation","collapsable":true,"children":["ZM/Annotation/AnnotationParser"]},{"title":"ZM/Annotation/Swoole","collapsable":true,"children":["ZM/Annotation/Swoole/OnSwooleEventBase"]},{"title":"ZM/Command","collapsable":true,"children":["ZM/Command/CheckConfigCommand"]},{"title":"ZM/Command/Module","collapsable":true,"children":["ZM/Command/Module/ModulePackCommand","ZM/Command/Module/ModuleListCommand"]},{"title":"ZM/Container","collapsable":true,"children":["ZM/Container/Container","ZM/Container/BoundMethod","ZM/Container/WorkerContainer"]},{"title":"ZM/Context","collapsable":true,"children":["ZM/Context/Context"]},{"title":"ZM/DB","collapsable":true,"children":["ZM/DB/UpdateBody","ZM/DB/DeleteBody","ZM/DB/DB","ZM/DB/SelectBody","ZM/DB/InsertBody","ZM/DB/Table"]},{"title":"ZM/Event","collapsable":true,"children":["ZM/Event/EventDispatcher","ZM/Event/EventManager","ZM/Event/EventTracer"]},{"title":"ZM/Event/SwooleEvent","collapsable":true,"children":["ZM/Event/SwooleEvent/OnTask","ZM/Event/SwooleEvent/OnWorkerStart","ZM/Event/SwooleEvent/OnMessage"]},{"title":"ZM/Http","collapsable":true,"children":["ZM/Http/Response"]},{"title":"ZM/Module","collapsable":true,"children":["ZM/Module/ModuleUnpacker","ZM/Module/QQBot","ZM/Module/ModuleBase","ZM/Module/ModulePacker"]},{"title":"ZM/MySQL","collapsable":true,"children":["ZM/MySQL/MySQLStatement","ZM/MySQL/MySQLPool","ZM/MySQL/MySQLQueryBuilder","ZM/MySQL/MySQLConnection","ZM/MySQL/MySQLWrapper","ZM/MySQL/MySQLStatementWrapper"]},{"title":"ZM/Store","collapsable":true,"children":["ZM/Store/LightCacheInside","ZM/Store/ZMAtomic","ZM/Store/LightCache"]},{"title":"ZM/Store/Redis","collapsable":true,"children":["ZM/Store/Redis/ZMRedis"]},{"title":"ZM/Utils","collapsable":true,"children":["ZM/Utils/Terminal","ZM/Utils/ZMUtil","ZM/Utils/SignalListener","ZM/Utils/CoMessage","ZM/Utils/MessageUtil","ZM/Utils/DataProvider","ZM/Utils/HttpUtil","ZM/Utils/ReflectionUtil"]},{"title":"ZM/Utils/Manager","collapsable":true,"children":["ZM/Utils/Manager/CronManager","ZM/Utils/Manager/ModuleManager","ZM/Utils/Manager/WorkerManager"]}] \ No newline at end of file diff --git a/docs/api/ZM/Container/BoundMethod.md b/docs/api/ZM/Container/BoundMethod.md new file mode 100644 index 00000000..65fd63ba --- /dev/null +++ b/docs/api/ZM/Container/BoundMethod.md @@ -0,0 +1,77 @@ +# ZM\Container\BoundMethod + +## call + +```php +public function call(Container $container, callable|string $callback, array $parameters, string $default_method): mixed +``` + +### 描述 + +调用指定闭包、类方法并注入依赖 + +### 参数 + +| 名称 | 类型 | 描述 | +| -------- | ---- | ----------- | +| container | Container | | +| callback | callable|string | | +| parameters | array | | +| default_method | string | | + +### 返回 + +| 类型 | 描述 | +| ---- | ----------- | +| mixed | | + + +## getMethodDependencies + +```php +public function getMethodDependencies(callable|string $callback, ZM\Container\ContainerInterface $container, array $parameters): array +``` + +### 描述 + +Get all dependencies for a given method. + +### 参数 + +| 名称 | 类型 | 描述 | +| -------- | ---- | ----------- | +| callback | callable|string | | +| container | ZM\Container\ContainerInterface | | +| parameters | array | | + +### 返回 + +| 类型 | 描述 | +| ---- | ----------- | +| array | | + + +## addDependencyForCallParameter + +```php +public function addDependencyForCallParameter(ZM\Container\ContainerInterface $container, ReflectionParameter $parameter, array $parameters, array $dependencies): void +``` + +### 描述 + +Get the dependency for the given call parameter. + +### 参数 + +| 名称 | 类型 | 描述 | +| -------- | ---- | ----------- | +| container | ZM\Container\ContainerInterface | | +| parameter | ReflectionParameter | | +| parameters | array | | +| dependencies | array | | + +### 返回 + +| 类型 | 描述 | +| ---- | ----------- | +| void | | diff --git a/docs/api/ZM/Container/Container.md b/docs/api/ZM/Container/Container.md new file mode 100644 index 00000000..327e7bad --- /dev/null +++ b/docs/api/ZM/Container/Container.md @@ -0,0 +1,84 @@ +# ZM\Container\Container + +## getParent + +```php +public function getParent(): ZM\Container\ContainerInterface +``` + +### 描述 + +获取父容器 + +### 返回 + +| 类型 | 描述 | +| ---- | ----------- | +| ZM\Container\ContainerInterface | | + + +## has + +```php +public function has(string $id): bool +``` + +### 描述 + +Returns true if the container can return an entry for the given identifier. +Returns false otherwise. +`has($id)` returning true does not mean that `get($id)` will not throw an exception. +It does however mean that `get($id)` will not throw a `NotFoundExceptionInterface`. + +### 参数 + +| 名称 | 类型 | 描述 | +| -------- | ---- | ----------- | +| id | string | identifier of the entry to look for | + +### 返回 + +| 类型 | 描述 | +| ---- | ----------- | +| bool | | + + +## make + +```php +public function make(class-string $abstract, array $parameters): Closure|mixed|T +``` + +### 描述 + +获取一个绑定的实例 + +### 参数 + +| 名称 | 类型 | 描述 | +| -------- | ---- | ----------- | +| abstract | class-string | 类或接口名 | +| parameters | array | 参数 | + +### 返回 + +| 类型 | 描述 | +| ---- | ----------- | +| Closure|mixed|T | 实例 | + + +## flush + +```php +public function flush(): void +``` + +### 描述 + +清除所有绑定和实例 + +### 返回 + +| 类型 | 描述 | +| ---- | ----------- | +| void | | diff --git a/docs/api/ZM/Container/WorkerContainer.md b/docs/api/ZM/Container/WorkerContainer.md new file mode 100644 index 00000000..f4cd3527 --- /dev/null +++ b/docs/api/ZM/Container/WorkerContainer.md @@ -0,0 +1,841 @@ +# ZM\Container\WorkerContainer + +## bound + +```php +public function bound(string $abstract): bool +``` + +### 描述 + +判断对应的类或接口是否已经注册 + +### 参数 + +| 名称 | 类型 | 描述 | +| -------- | ---- | ----------- | +| abstract | string | 类或接口名 | + +### 返回 + +| 类型 | 描述 | +| ---- | ----------- | +| bool | | + + +## getAlias + +```php +public function getAlias(string $abstract): string +``` + +### 描述 + +获取类别名(如存在) + +### 参数 + +| 名称 | 类型 | 描述 | +| -------- | ---- | ----------- | +| abstract | string | 类或接口名 | + +### 返回 + +| 类型 | 描述 | +| ---- | ----------- | +| string | 别名,不存在时返回传入的类或接口名 | + + +## alias + +```php +public function alias(string $abstract, string $alias): void +``` + +### 描述 + +注册一个类别名 + +### 参数 + +| 名称 | 类型 | 描述 | +| -------- | ---- | ----------- | +| abstract | string | 类或接口名 | +| alias | string | 别名 | + +### 返回 + +| 类型 | 描述 | +| ---- | ----------- | +| void | | + + +## bind + +```php +public function bind(string $abstract, null|Closure|string $concrete, bool $shared): void +``` + +### 描述 + +注册绑定 + +### 参数 + +| 名称 | 类型 | 描述 | +| -------- | ---- | ----------- | +| abstract | string | 类或接口名 | +| concrete | null|Closure|string | 返回类实例的闭包,或是类名 | +| shared | bool | 是否共享 | + +### 返回 + +| 类型 | 描述 | +| ---- | ----------- | +| void | | + + +## bindIf + +```php +public function bindIf(string $abstract, null|Closure|string $concrete, bool $shared): void +``` + +### 描述 + +注册绑定 +在已经绑定时不会重复注册 + +### 参数 + +| 名称 | 类型 | 描述 | +| -------- | ---- | ----------- | +| abstract | string | 类或接口名 | +| concrete | null|Closure|string | 返回类实例的闭包,或是类名 | +| shared | bool | 是否共享 | + +### 返回 + +| 类型 | 描述 | +| ---- | ----------- | +| void | | + + +## singleton + +```php +public function singleton(string $abstract, null|Closure|string $concrete): void +``` + +### 描述 + +注册一个单例绑定 + +### 参数 + +| 名称 | 类型 | 描述 | +| -------- | ---- | ----------- | +| abstract | string | 类或接口名 | +| concrete | null|Closure|string | 返回类实例的闭包,或是类名 | + +### 返回 + +| 类型 | 描述 | +| ---- | ----------- | +| void | | + + +## singletonIf + +```php +public function singletonIf(string $abstract, null|Closure|string $concrete): void +``` + +### 描述 + +注册一个单例绑定 +在已经绑定时不会重复注册 + +### 参数 + +| 名称 | 类型 | 描述 | +| -------- | ---- | ----------- | +| abstract | string | 类或接口名 | +| concrete | null|Closure|string | 返回类实例的闭包,或是类名 | + +### 返回 + +| 类型 | 描述 | +| ---- | ----------- | +| void | | + + +## instance + +```php +public function instance(string $abstract, mixed $instance): mixed +``` + +### 描述 + +注册一个已有的实例,效果等同于单例绑定 + +### 参数 + +| 名称 | 类型 | 描述 | +| -------- | ---- | ----------- | +| abstract | string | 类或接口名 | +| instance | mixed | 实例 | + +### 返回 + +| 类型 | 描述 | +| ---- | ----------- | +| mixed | | + + +## factory + +```php +public function factory(string $abstract): Closure +``` + +### 描述 + +获取一个解析对应类实例的闭包 + +### 参数 + +| 名称 | 类型 | 描述 | +| -------- | ---- | ----------- | +| abstract | string | 类或接口名 | + +### 返回 + +| 类型 | 描述 | +| ---- | ----------- | +| Closure | | + + +## flush + +```php +public function flush(): void +``` + +### 描述 + +清除所有绑定和实例 + +### 返回 + +| 类型 | 描述 | +| ---- | ----------- | +| void | | + + +## make + +```php +public function make(class-string $abstract, array $parameters): Closure|mixed|T +``` + +### 描述 + +获取一个绑定的实例 + +### 参数 + +| 名称 | 类型 | 描述 | +| -------- | ---- | ----------- | +| abstract | class-string | 类或接口名 | +| parameters | array | 参数 | + +### 返回 + +| 类型 | 描述 | +| ---- | ----------- | +| Closure|mixed|T | 实例 | + + +## build + +```php +public function build(Closure|string $concrete): mixed +``` + +### 描述 + +实例化具体的类实例 + +### 参数 + +| 名称 | 类型 | 描述 | +| -------- | ---- | ----------- | +| concrete | Closure|string | 类名或对应的闭包 | + +### 返回 + +| 类型 | 描述 | +| ---- | ----------- | +| mixed | | + + +## call + +```php +public function call(callable|string $callback, array $parameters, null|string $default_method): mixed +``` + +### 描述 + +调用对应的方法,并自动注入依赖 + +### 参数 + +| 名称 | 类型 | 描述 | +| -------- | ---- | ----------- | +| callback | callable|string | 对应的方法 | +| parameters | array | 参数 | +| default_method | null|string | 默认方法 | + +### 返回 + +| 类型 | 描述 | +| ---- | ----------- | +| mixed | | + + +## get + +```php +public function get(string $id): mixed +``` + +### 描述 + +Finds an entry of the container by its identifier and returns it. + +### 参数 + +| 名称 | 类型 | 描述 | +| -------- | ---- | ----------- | +| id | string | identifier of the entry to look for * | + +### 返回 + +| 类型 | 描述 | +| ---- | ----------- | +| mixed | entry | + + +## has + +```php +public function has(string $id): bool +``` + +### 描述 + +Returns true if the container can return an entry for the given identifier. +Returns false otherwise. +`has($id)` returning true does not mean that `get($id)` will not throw an exception. +It does however mean that `get($id)` will not throw a `NotFoundExceptionInterface`. + +### 参数 + +| 名称 | 类型 | 描述 | +| -------- | ---- | ----------- | +| id | string | identifier of the entry to look for | + +### 返回 + +| 类型 | 描述 | +| ---- | ----------- | +| bool | | + + +## extend + +```php +public function extend(string $abstract, Closure $closure): void +``` + +### 描述 + +扩展一个类或接口 + +### 参数 + +| 名称 | 类型 | 描述 | +| -------- | ---- | ----------- | +| abstract | string | 类或接口名 | +| closure | Closure | 扩展闭包 | + +### 返回 + +| 类型 | 描述 | +| ---- | ----------- | +| void | | + + +## getLogPrefix + +```php +public function getLogPrefix(): string +``` + +### 描述 + +获取日志前缀 + +### 返回 + +| 类型 | 描述 | +| ---- | ----------- | +| string | | + + +## setLogPrefix + +```php +public function setLogPrefix(string $prefix): void +``` + +### 描述 + +设置日志前缀 + +### 参数 + +| 名称 | 类型 | 描述 | +| -------- | ---- | ----------- | +| prefix | string | | + +### 返回 + +| 类型 | 描述 | +| ---- | ----------- | +| void | | + + +## getExtenders + +```php +public function getExtenders(string $abstract): Closure[] +``` + +### 描述 + +获取对应类型的所有扩展器 + +### 参数 + +| 名称 | 类型 | 描述 | +| -------- | ---- | ----------- | +| abstract | string | 类或接口名 | + +### 返回 + +| 类型 | 描述 | +| ---- | ----------- | +| Closure[] | | + + +## isAlias + +```php +public function isAlias(string $name): bool +``` + +### 描述 + +判断传入的是否为别名 + +### 参数 + +| 名称 | 类型 | 描述 | +| -------- | ---- | ----------- | +| name | string | | + +### 返回 + +| 类型 | 描述 | +| ---- | ----------- | +| bool | | + + +## dropStaleInstances + +```php +public function dropStaleInstances(string $abstract): void +``` + +### 描述 + +抛弃所有过时的实例和别名 + +### 参数 + +| 名称 | 类型 | 描述 | +| -------- | ---- | ----------- | +| abstract | string | 类或接口名 | + +### 返回 + +| 类型 | 描述 | +| ---- | ----------- | +| void | | + + +## getClosure + +```php +public function getClosure(string $abstract, string $concrete): Closure +``` + +### 描述 + +获取一个解析对应类的闭包 + +### 参数 + +| 名称 | 类型 | 描述 | +| -------- | ---- | ----------- | +| abstract | string | 类或接口名 | +| concrete | string | 实际类名 | + +### 返回 + +| 类型 | 描述 | +| ---- | ----------- | +| Closure | | + + +## getLastParameterOverride + +```php +public function getLastParameterOverride(): array +``` + +### 描述 + +获取最后一次的覆盖参数 + +### 返回 + +| 类型 | 描述 | +| ---- | ----------- | +| array | | + + +## notInstantiable + +```php +public function notInstantiable(string $concrete, string $reason): void +``` + +### 描述 + +抛出实例化异常 + +### 参数 + +| 名称 | 类型 | 描述 | +| -------- | ---- | ----------- | +| concrete | string | | +| reason | string | | + +### 返回 + +| 类型 | 描述 | +| ---- | ----------- | +| void | | + + +## resolveDependencies + +```php +public function resolveDependencies(ReflectionParameter[] $dependencies): array +``` + +### 描述 + +解析依赖 + +### 参数 + +| 名称 | 类型 | 描述 | +| -------- | ---- | ----------- | +| dependencies | ReflectionParameter[] | | + +### 返回 + +| 类型 | 描述 | +| ---- | ----------- | +| array | | + + +## hasParameterOverride + +```php +public function hasParameterOverride(ReflectionParameter $parameter): bool +``` + +### 描述 + +判断传入的参数是否存在覆盖参数 + +### 参数 + +| 名称 | 类型 | 描述 | +| -------- | ---- | ----------- | +| parameter | ReflectionParameter | | + +### 返回 + +| 类型 | 描述 | +| ---- | ----------- | +| bool | | + + +## getParameterOverride + +```php +public function getParameterOverride(ReflectionParameter $parameter): mixed +``` + +### 描述 + +获取覆盖参数 + +### 参数 + +| 名称 | 类型 | 描述 | +| -------- | ---- | ----------- | +| parameter | ReflectionParameter | | + +### 返回 + +| 类型 | 描述 | +| ---- | ----------- | +| mixed | | + + +## hasParameterTypeOverride + +```php +public function hasParameterTypeOverride(ReflectionParameter $parameter): bool +``` + +### 描述 + +判断传入的参数是否存在临时注入的参数 + +### 参数 + +| 名称 | 类型 | 描述 | +| -------- | ---- | ----------- | +| parameter | ReflectionParameter | | + +### 返回 + +| 类型 | 描述 | +| ---- | ----------- | +| bool | | + + +## getParameterTypeOverride + +```php +public function getParameterTypeOverride(ReflectionParameter $parameter): mixed +``` + +### 描述 + +获取临时注入的参数 + +### 参数 + +| 名称 | 类型 | 描述 | +| -------- | ---- | ----------- | +| parameter | ReflectionParameter | | + +### 返回 + +| 类型 | 描述 | +| ---- | ----------- | +| mixed | | + + +## resolvePrimitive + +```php +public function resolvePrimitive(ReflectionParameter $parameter): mixed +``` + +### 描述 + +解析基本类型 + +### 参数 + +| 名称 | 类型 | 描述 | +| -------- | ---- | ----------- | +| parameter | ReflectionParameter | | + +### 返回 + +| 类型 | 描述 | +| ---- | ----------- | +| mixed | 对应类型的默认值 | + + +## resolveClass + +```php +public function resolveClass(ReflectionParameter $parameter): mixed +``` + +### 描述 + +解析类 + +### 参数 + +| 名称 | 类型 | 描述 | +| -------- | ---- | ----------- | +| parameter | ReflectionParameter | | + +### 返回 + +| 类型 | 描述 | +| ---- | ----------- | +| mixed | | + + +## getConcrete + +```php +public function getConcrete(string $abstract): Closure|string +``` + +### 描述 + +获取类名的实际类型 + +### 参数 + +| 名称 | 类型 | 描述 | +| -------- | ---- | ----------- | +| abstract | string | 类或接口名 | + +### 返回 + +| 类型 | 描述 | +| ---- | ----------- | +| Closure|string | | + + +## isBuildable + +```php +public function isBuildable(mixed $concrete, string $abstract): bool +``` + +### 描述 + +判断传入的实际类型是否可以构造 + +### 参数 + +| 名称 | 类型 | 描述 | +| -------- | ---- | ----------- | +| concrete | mixed | 实际类型 | +| abstract | string | 类或接口名 | + +### 返回 + +| 类型 | 描述 | +| ---- | ----------- | +| bool | | + + +## isShared + +```php +public function isShared(string $abstract): bool +``` + +### 描述 + +判断传入的类型是否为共享实例 + +### 参数 + +| 名称 | 类型 | 描述 | +| -------- | ---- | ----------- | +| abstract | string | 类或接口名 | + +### 返回 + +| 类型 | 描述 | +| ---- | ----------- | +| bool | | + + +## shouldLog + +```php +public function shouldLog(): bool +``` + +### 描述 + +判断是否输出日志 + +### 返回 + +| 类型 | 描述 | +| ---- | ----------- | +| bool | | + + +## log + +```php +public function log(string $message): void +``` + +### 描述 + +记录日志(自动附加容器日志前缀) + +### 参数 + +| 名称 | 类型 | 描述 | +| -------- | ---- | ----------- | +| message | string | | + +### 返回 + +| 类型 | 描述 | +| ---- | ----------- | +| void | | + + +## getInstance + +```php +public function getInstance(): static +``` + +### 描述 + +获取类实例 + +### 返回 + +| 类型 | 描述 | +| ---- | ----------- | +| static | | diff --git a/docs/api/ZM/Event/SwooleEvent/OnMessage.md b/docs/api/ZM/Event/SwooleEvent/OnMessage.md index f61b9e69..b8f63bb4 100644 --- a/docs/api/ZM/Event/SwooleEvent/OnMessage.md +++ b/docs/api/ZM/Event/SwooleEvent/OnMessage.md @@ -1 +1,24 @@ -# ZM\Event\SwooleEvent\OnMessage \ No newline at end of file +# ZM\Event\SwooleEvent\OnMessage + +## registerRequestContainerBindings + +```php +public function registerRequestContainerBindings(Swoole\WebSocket\Frame $frame, ZM\ConnectionManager\ConnectionObject $conn): void +``` + +### 描述 + +注册请求容器绑定 + +### 参数 + +| 名称 | 类型 | 描述 | +| -------- | ---- | ----------- | +| frame | Swoole\WebSocket\Frame | | +| conn | ZM\ConnectionManager\ConnectionObject | | + +### 返回 + +| 类型 | 描述 | +| ---- | ----------- | +| void | | diff --git a/docs/api/ZM/Event/SwooleEvent/OnWorkerStart.md b/docs/api/ZM/Event/SwooleEvent/OnWorkerStart.md index 85a18f9a..0187f583 100644 --- a/docs/api/ZM/Event/SwooleEvent/OnWorkerStart.md +++ b/docs/api/ZM/Event/SwooleEvent/OnWorkerStart.md @@ -15,3 +15,26 @@ public function loadAnnotations(): mixed | 类型 | 描述 | | ---- | ----------- | | mixed | | + + +## registerWorkerContainerBindings + +```php +public function registerWorkerContainerBindings(Swoole\WebSocket\Server $server): void +``` + +### 描述 + +注册进程容器绑定 + +### 参数 + +| 名称 | 类型 | 描述 | +| -------- | ---- | ----------- | +| server | Swoole\WebSocket\Server | | + +### 返回 + +| 类型 | 描述 | +| ---- | ----------- | +| void | | diff --git a/docs/api/ZM/Framework.md b/docs/api/ZM/Framework.md index f4c1b71e..519646a1 100644 --- a/docs/api/ZM/Framework.md +++ b/docs/api/ZM/Framework.md @@ -1,5 +1,29 @@ # ZM\Framework +## __construct + +```php +public function __construct(array $args, bool $instant_mode): mixed +``` + +### 描述 + +创建一个新的框架实例 + +### 参数 + +| 名称 | 类型 | 描述 | +| -------- | ---- | ----------- | +| args | array | 运行参数 | +| instant_mode | bool | 是否为单文件模式 | + +### 返回 + +| 类型 | 描述 | +| ---- | ----------- | +| mixed | | + + ## saveProcessState ```php diff --git a/docs/api/ZM/Module/QQBot.md b/docs/api/ZM/Module/QQBot.md index 255ebeb6..0ef0901e 100644 --- a/docs/api/ZM/Module/QQBot.md +++ b/docs/api/ZM/Module/QQBot.md @@ -137,15 +137,15 @@ public function dispatchAPIResponse(mixed $req): mixed ## getInstance ```php -public function getInstance(): self +public function getInstance(): static ``` ### 描述 -作者很懒,什么也没有说 +获取类实例 ### 返回 | 类型 | 描述 | | ---- | ----------- | -| self | | +| static | | diff --git a/docs/api/ZM/Utils/DataProvider.md b/docs/api/ZM/Utils/DataProvider.md index e4ee4501..3e911322 100644 --- a/docs/api/ZM/Utils/DataProvider.md +++ b/docs/api/ZM/Utils/DataProvider.md @@ -201,3 +201,26 @@ public function isRelativePath(string $path): bool | 类型 | 描述 | | ---- | ----------- | | bool | 返回结果 | + + +## createIfNotExists + +```php +public function createIfNotExists(string $path): void +``` + +### 描述 + +创建目录(如果不存在) + +### 参数 + +| 名称 | 类型 | 描述 | +| -------- | ---- | ----------- | +| path | string | 目录路径 | + +### 返回 + +| 类型 | 描述 | +| ---- | ----------- | +| void | | diff --git a/docs/api/ZM/Utils/ReflectionUtil.md b/docs/api/ZM/Utils/ReflectionUtil.md new file mode 100644 index 00000000..86a7c3bb --- /dev/null +++ b/docs/api/ZM/Utils/ReflectionUtil.md @@ -0,0 +1,95 @@ +# ZM\Utils\ReflectionUtil + +## getParameterClassName + +```php +public function getParameterClassName(ReflectionParameter $parameter): null|string +``` + +### 描述 + +获取参数的类名(如有) + +### 参数 + +| 名称 | 类型 | 描述 | +| -------- | ---- | ----------- | +| parameter | ReflectionParameter | 参数 | + +### 返回 + +| 类型 | 描述 | +| ---- | ----------- | +| null|string | 类名,如果参数不是类,返回 null | + + +## variableToString + +```php +public function variableToString(mixed $var): string +``` + +### 描述 + +将传入变量转换为字符串 + +### 参数 + +| 名称 | 类型 | 描述 | +| -------- | ---- | ----------- | +| var | mixed | | + +### 返回 + +| 类型 | 描述 | +| ---- | ----------- | +| string | | + + +## isNonStaticMethod + +```php +public function isNonStaticMethod(callable|string $callback): bool +``` + +### 描述 + +判断传入的回调是否为任意类的非静态方法 + +### 参数 + +| 名称 | 类型 | 描述 | +| -------- | ---- | ----------- | +| callback | callable|string | 回调 | + +### 返回 + +| 类型 | 描述 | +| ---- | ----------- | +| bool | | + + +## getCallReflector + +```php +public function getCallReflector(callable|string $callback): ReflectionFunctionAbstract +``` + +### 描述 + +获取传入的回调的反射实例 +如果传入的是类方法,则会返回 {@link ReflectionMethod} 实例 +否则将返回 {@link ReflectionFunction} 实例 +可传入实现了 __invoke 的类 + +### 参数 + +| 名称 | 类型 | 描述 | +| -------- | ---- | ----------- | +| callback | callable|string | 回调 | + +### 返回 + +| 类型 | 描述 | +| ---- | ----------- | +| ReflectionFunctionAbstract | |