mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-02 22:35:38 +08:00
Compare commits
210 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
47cca37854 | ||
|
|
0fa49171b9 | ||
|
|
ea1d14ba00 | ||
|
|
a01791ddbe | ||
|
|
51a9c5c4e8 | ||
|
|
b1e37943df | ||
|
|
5459d1c5ff | ||
|
|
21373097bb | ||
|
|
f4f7327695 | ||
|
|
36fc2cb4cd | ||
|
|
b7469b9dd4 | ||
|
|
e7e77c99d0 | ||
|
|
6fbd35ed33 | ||
|
|
fba2339280 | ||
|
|
bd8270a4ae | ||
|
|
5299061c87 | ||
|
|
e843aeac55 | ||
|
|
19c792209b | ||
|
|
277d442634 | ||
|
|
51bec043e3 | ||
|
|
b7595f6f22 | ||
|
|
55181d583f | ||
|
|
b5a5a4f32e | ||
|
|
a746779efa | ||
|
|
736b6ea0a5 | ||
|
|
884f07baa6 | ||
|
|
b496c3136e | ||
|
|
bbfb40f973 | ||
|
|
a73e1fc164 | ||
|
|
ef7acb7fa0 | ||
|
|
fcd108adbe | ||
|
|
c9c76bfd10 | ||
|
|
d9302a3120 | ||
|
|
0cb3308dd1 | ||
|
|
583b9d7cf7 | ||
|
|
d7728ebc25 | ||
|
|
b6742526aa | ||
|
|
4defd8ac1b | ||
|
|
d28672e2ad | ||
|
|
94d6a51358 | ||
|
|
54eabc948f | ||
|
|
6c9e26ce83 | ||
|
|
a934037179 | ||
|
|
396444a089 | ||
|
|
699444abdd | ||
|
|
088031f807 | ||
|
|
8ce6e2c111 | ||
|
|
e7f36b9fcf | ||
|
|
dab91f526e | ||
|
|
35e23a7cbc | ||
|
|
7df05df48f | ||
|
|
707a1ae628 | ||
|
|
a65fc4076b | ||
|
|
f487897cf2 | ||
|
|
869d9ed543 | ||
|
|
8f61ed7561 | ||
|
|
8cb6a32341 | ||
|
|
687260e53c | ||
|
|
a919ce4554 | ||
|
|
d19d7acedd | ||
|
|
a393b3aff5 | ||
|
|
8c2036b6b4 | ||
|
|
dc081861ad | ||
|
|
ec76d2ba7d | ||
|
|
47ce0a8e9c | ||
|
|
f1c730962b | ||
|
|
d95a5131f6 | ||
|
|
69637cf482 | ||
|
|
25d6ec3a92 | ||
|
|
8bf5ff4e7f | ||
|
|
fd4e4be3a8 | ||
|
|
e0a01ea2ca | ||
|
|
256ccb96a6 | ||
|
|
bfffdc7d21 | ||
|
|
3bbe21268b | ||
|
|
1537e88a74 | ||
|
|
0d9711e62d | ||
|
|
0a7c5f06c6 | ||
|
|
e7a8a32b73 | ||
|
|
62b703f2e4 | ||
|
|
f44921d136 | ||
|
|
cd42545c7d | ||
|
|
0df3fd7bed | ||
|
|
56241da281 | ||
|
|
05a04104dd | ||
|
|
50d27ee186 | ||
|
|
371926b5a6 | ||
|
|
97face2406 | ||
|
|
ea64b40011 | ||
|
|
6d23e489aa | ||
|
|
f4d75e211f | ||
|
|
48f6cc644d | ||
|
|
33f517333f | ||
|
|
7253a309c7 | ||
|
|
f2aff5882d | ||
|
|
0dd61a7270 | ||
|
|
420b8e6d67 | ||
|
|
9e08919ce0 | ||
|
|
a7324f6c49 | ||
|
|
721c0834db | ||
|
|
e37629aaea | ||
|
|
a43a4a429e | ||
|
|
f5d34198e7 | ||
|
|
46604293e9 | ||
|
|
58e405cccd | ||
|
|
1deea5bebc | ||
|
|
cad5636f92 | ||
|
|
90290bee94 | ||
|
|
9f7ebceeb9 | ||
|
|
60ea2c7e12 | ||
|
|
441c866160 | ||
|
|
33d3341bb3 | ||
|
|
1d778fd78e | ||
|
|
0cd73a6304 | ||
|
|
2fedfe5b18 | ||
|
|
77c140bee6 | ||
|
|
c06e38d71f | ||
|
|
9b59cec22a | ||
|
|
306e992789 | ||
|
|
8335cfed69 | ||
|
|
4702aa1987 | ||
|
|
145e1b31a0 | ||
|
|
f2e28de20c | ||
|
|
bcaaf88edb | ||
|
|
120698fb43 | ||
|
|
dd88585ffa | ||
|
|
93a8c450ad | ||
|
|
3451434997 | ||
|
|
0bab2e74b0 | ||
|
|
c1a877489b | ||
|
|
520099aaba | ||
|
|
9bd02b3dd2 | ||
|
|
ba64f2c189 | ||
|
|
fbb194a6c5 | ||
|
|
30b2d2134b | ||
|
|
7eea71e282 | ||
|
|
e40b3029e0 | ||
|
|
17492c78fa | ||
|
|
a9276d3f72 | ||
|
|
eecbe49955 | ||
|
|
be9874a9ad | ||
|
|
b4fcc057c5 | ||
|
|
d9499dc56b | ||
|
|
f6806c88ab | ||
|
|
2caca545ad | ||
|
|
ff0f11da7f | ||
|
|
daa1822bc5 | ||
|
|
d490892092 | ||
|
|
182a4e7b06 | ||
|
|
e9beed03ea | ||
|
|
8351527aea | ||
|
|
ddff663b0b | ||
|
|
31b4fb9201 | ||
|
|
1f7f0da383 | ||
|
|
9fa1079248 | ||
|
|
ae0cf5e3d7 | ||
|
|
672369c598 | ||
|
|
73687f248b | ||
|
|
65cc2a948a | ||
|
|
299f36dcc0 | ||
|
|
f5cbce5195 | ||
|
|
a3780667b2 | ||
|
|
a21742a326 | ||
|
|
40aacb2e61 | ||
|
|
ba18869c85 | ||
|
|
a454f2c523 | ||
|
|
7caebaa6ba | ||
|
|
580abd7317 | ||
|
|
3187431611 | ||
|
|
81c37c9a0a | ||
|
|
ba5bca20da | ||
|
|
533fe187bd | ||
|
|
c4da26c19d | ||
|
|
ca7bfcc8c6 | ||
|
|
6c7b582faf | ||
|
|
6f2e6135f1 | ||
|
|
37a92e03c1 | ||
|
|
35385f8916 | ||
|
|
a2fbdd8e0a | ||
|
|
bab610722f | ||
|
|
4cabc8d132 | ||
|
|
e8bd381907 | ||
|
|
42aac802dd | ||
|
|
d748a20445 | ||
|
|
5db3ff934d | ||
|
|
9bfa3ede20 | ||
|
|
127466e546 | ||
|
|
16aa30cac7 | ||
|
|
05a3d0111b | ||
|
|
9f4b5fb14a | ||
|
|
a716e68f87 | ||
|
|
2e127771ed | ||
|
|
c6bbba6051 | ||
|
|
443ed115b0 | ||
|
|
f450b8d863 | ||
|
|
acf570e652 | ||
|
|
4e9199c68e | ||
|
|
6f5575b155 | ||
|
|
700b854434 | ||
|
|
37b5d954e9 | ||
|
|
ac50e96568 | ||
|
|
86174c2e9f | ||
|
|
c1ae1dee06 | ||
|
|
c4aedf2958 | ||
|
|
736c8f2fc0 | ||
|
|
294084299e | ||
|
|
b1d30da4bc | ||
|
|
506f2e7c0c | ||
|
|
e13660dcdc | ||
|
|
4fbe2aa5af |
15
.editorconfig
Normal file
15
.editorconfig
Normal file
@@ -0,0 +1,15 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[*.{yml,yaml}]
|
||||
indent_size = 2
|
||||
30
.github/workflows/build.yml
vendored
30
.github/workflows/build.yml
vendored
@@ -1,30 +0,0 @@
|
||||
name: Build
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
types:
|
||||
- closed
|
||||
paths:
|
||||
- 'src/**.php'
|
||||
|
||||
jobs:
|
||||
incremental-build-number:
|
||||
if: github.event.pull_request.merged == true
|
||||
name: Incremental Build Number
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Increment build number
|
||||
run: sed -i -r 's/(.*)(\VERSION_ID\s=\s)([0-9]+)(.*)/echo "\1\2$((\3+1))\4"/ge' src/ZM/ConsoleApplication.php
|
||||
|
||||
- name: Commit change
|
||||
run: |
|
||||
git config --global user.name 'Github Build Bot'
|
||||
git config --global user.email 'noreply@github.com'
|
||||
git add src/ZM/ConsoleApplication.php
|
||||
git commit -m "increment build number"
|
||||
git push
|
||||
69
.github/workflows/increment-build-number.yml
vendored
Normal file
69
.github/workflows/increment-build-number.yml
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
name: Increment Build Number
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
types:
|
||||
- closed
|
||||
paths:
|
||||
- 'src/**.php'
|
||||
|
||||
jobs:
|
||||
incremental-build-number:
|
||||
if: github.event.pull_request.merged == true
|
||||
name: Incremental Build Number
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup PHP
|
||||
uses: "shivammathur/setup-php@v2"
|
||||
with:
|
||||
php-version: '8.1'
|
||||
extensions: swoole, posix, json
|
||||
|
||||
- name: Setup problem matchers for PHP
|
||||
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
|
||||
|
||||
- name: Get composer cache directory
|
||||
id: composer-cache
|
||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
|
||||
- name: Cache dependencies
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.dir }}
|
||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||
restore-keys: ${{ runner.os }}-composer-
|
||||
|
||||
- name: Install Composer Dependencies
|
||||
run: "composer install --prefer-dist --no-progress --optimize-autoloader"
|
||||
|
||||
- name: Generate API Docs
|
||||
id: generate-api-docs
|
||||
continue-on-error: true
|
||||
run: bin/gendoc
|
||||
|
||||
- name: Commit api docs
|
||||
if: steps.generate-api-docs.outcome == 'success'
|
||||
continue-on-error: true
|
||||
run: |
|
||||
git config --global user.name 'Github Build Bot'
|
||||
git config --global user.email 'noreply@github.com'
|
||||
git add docs
|
||||
git commit -m "update api docs"
|
||||
git push
|
||||
|
||||
- name: Increment build number
|
||||
run: sed -i -r 's/(.*)(\VERSION_ID\s=\s)([0-9]+)(.*)/echo "\1\2$((\3+1))\4"/ge' src/ZM/ConsoleApplication.php
|
||||
|
||||
- name: Commit build number
|
||||
run: |
|
||||
BUILD_ID=$(cat src/ZM/ConsoleApplication.php | grep "VERSION_ID = " | sed 's/[^0-9]//g')
|
||||
git config --global user.name 'Github Build Bot'
|
||||
git config --global user.email 'noreply@github.com'
|
||||
git add src/ZM/ConsoleApplication.php
|
||||
git commit -m "increment build number (build $BUILD_ID)"
|
||||
git push
|
||||
52
.github/workflows/integration-test.yml
vendored
52
.github/workflows/integration-test.yml
vendored
@@ -1,12 +1,11 @@
|
||||
name: Integration Test
|
||||
name: Integration and Style Test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
- 'docs/**'
|
||||
paths:
|
||||
- '**/**.php'
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
@@ -16,9 +15,8 @@ on:
|
||||
- reopened
|
||||
- ready_for_review
|
||||
- review_requested
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
- 'docs/**'
|
||||
paths:
|
||||
- '**/**.php'
|
||||
|
||||
jobs:
|
||||
integration:
|
||||
@@ -37,6 +35,8 @@ jobs:
|
||||
with:
|
||||
php-version: ${{ matrix.php-versions }}
|
||||
extensions: swoole, posix, json
|
||||
env:
|
||||
SWOOLE_CONFIGURE_OPTS: --enable-openssl
|
||||
|
||||
- name: Setup problem matchers for PHP
|
||||
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
|
||||
@@ -61,5 +61,41 @@ jobs:
|
||||
- name: Run Static Analysis
|
||||
run: "composer analyse"
|
||||
|
||||
- name: Run PHPUnit
|
||||
run: "composer test"
|
||||
|
||||
cs-check:
|
||||
name: PHP CS Fixer Check
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup PHP 7.2
|
||||
uses: "shivammathur/setup-php@v2"
|
||||
with:
|
||||
php-version: "7.2"
|
||||
extensions: swoole, posix, json
|
||||
|
||||
- name: Setup problem matchers for PHP
|
||||
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
|
||||
|
||||
- name: Validate composer.json
|
||||
run: "composer validate --strict"
|
||||
|
||||
- name: Get composer cache directory
|
||||
id: composer-cache
|
||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
|
||||
- name: Cache dependencies
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.dir }}
|
||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||
restore-keys: ${{ runner.os }}-composer-
|
||||
|
||||
- name: Install Composer Dependencies
|
||||
run: "composer install --prefer-dist --no-progress --optimize-autoloader"
|
||||
|
||||
- name: Run PHP CS Fixer Check
|
||||
run: "./vendor/bin/php-cs-fixer fix --dry-run --diff"
|
||||
run: "composer cs-fix -- --dry-run --diff"
|
||||
|
||||
13
.github/workflows/vuepress-deploy.yml
vendored
13
.github/workflows/vuepress-deploy.yml
vendored
@@ -1,8 +1,11 @@
|
||||
name: VuePress Auto Deploy
|
||||
name: Docs and Script Auto Deploy
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
paths:
|
||||
- 'docs/**'
|
||||
- 'ext/**'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@@ -30,3 +33,11 @@ jobs:
|
||||
REMOTE_HOST: ${{ secrets.ZHAMAO_XIN_HOST }}
|
||||
REMOTE_USER: ${{ secrets.ZHAMAO_XIN_USER }}
|
||||
TARGET: ${{ secrets.ZHAMAO_XIN_TARGET }}
|
||||
- name: deploy script file
|
||||
uses: wlixcc/SFTP-Deploy-Action@v1.0
|
||||
with:
|
||||
username: ${{ secrets.ZHAMAO_XIN_USER }}
|
||||
server: ${{ secrets.ZHAMAO_XIN_HOST }}
|
||||
ssh_private_key: ${{ secrets.ZHAMAO_XIN_PRIVATE_KEY }}
|
||||
local_path: './ext/go.sh'
|
||||
remote_path: ${{ secrets.ZHAMAO_XIN_MAIN_TARGET }}
|
||||
|
||||
72
.gitignore
vendored
72
.gitignore
vendored
@@ -1,21 +1,26 @@
|
||||
.idea/
|
||||
/src/test/
|
||||
/src/webconsole/config/
|
||||
/vendor/
|
||||
### Zhamao Framework ###
|
||||
/zm_data/
|
||||
composer.lock
|
||||
/resources/server.phar
|
||||
/distribute/
|
||||
/bin/.phpunit.result.cache
|
||||
/resources/zhamao.service
|
||||
.phpunit.result.cache
|
||||
.daemon_pid
|
||||
/runtime/
|
||||
/tmp/
|
||||
/temp/
|
||||
/site/
|
||||
|
||||
# go-cqhttp快速安装启动相关(可能被废弃)
|
||||
# 框架审计文件
|
||||
audit.log
|
||||
|
||||
# 进程锁文件
|
||||
.daemon_pid
|
||||
.zm_worker_*.pid
|
||||
|
||||
### Composer ###
|
||||
composer.phar
|
||||
/vendor/
|
||||
composer.lock
|
||||
|
||||
### Go CQHTTP ###
|
||||
/ext/go-cqhttp/data/
|
||||
/ext/go-cqhttp/logs/
|
||||
/ext/go-cqhttp/config.hjson
|
||||
@@ -23,12 +28,53 @@ composer.lock
|
||||
/ext/go-cqhttp/go-cqhttp
|
||||
/ext/go-cqhttp/session.token
|
||||
|
||||
.zm_worker_*.pid
|
||||
### Git ###
|
||||
# 备份文件
|
||||
*.orig
|
||||
|
||||
# Git Hook 的相关锁文件
|
||||
# 解决 Merge 冲突时可能会自动生成的文件
|
||||
*.BACKUP.*
|
||||
*.BASE.*
|
||||
*.LOCAL.*
|
||||
*.REMOTE.*
|
||||
*_BACKUP_*.txt
|
||||
*_BASE_*.txt
|
||||
*_LOCAL_*.txt
|
||||
*_REMOTE_*.txt
|
||||
|
||||
# Git Hooks
|
||||
cghooks.lock
|
||||
|
||||
# Vuepress 相关文件
|
||||
### VuePress ###
|
||||
/node_modules/
|
||||
/docs/.vuepress/dist/
|
||||
package-lock.json
|
||||
package-lock.json
|
||||
|
||||
### PHPUnit ###
|
||||
|
||||
# 生成的文件
|
||||
/bin/.phpunit.result.cache
|
||||
.phpunit.result.cache
|
||||
.phpunit.cache
|
||||
|
||||
# 本地配置
|
||||
/phpunit.xml
|
||||
|
||||
# 构建目录
|
||||
/build/
|
||||
|
||||
### PhpStorm ###
|
||||
# 兼容 PHPStorm 及其他 Jetbrains IDE
|
||||
|
||||
# 除了代码格式配置和运行配置之外的所有文件
|
||||
.idea/*
|
||||
|
||||
!.idea/codeStyles
|
||||
!.idea/runConfigurations
|
||||
|
||||
### Phive ###
|
||||
/.phive/
|
||||
/tools/
|
||||
|
||||
### ASDF ###
|
||||
/.tool-version
|
||||
|
||||
@@ -65,11 +65,11 @@ return (new PhpCsFixer\Config())
|
||||
'standardize_not_equals' => true,
|
||||
'multiline_comment_opening_closing' => true,
|
||||
'phpdoc_summary' => false,
|
||||
'php_unit_test_class_requires_covers' => false,
|
||||
])
|
||||
->setFinder(
|
||||
PhpCsFixer\Finder::create()
|
||||
->exclude('vendor')
|
||||
->exclude('docs')
|
||||
->in(__DIR__ . '/src')
|
||||
->in(__DIR__ . '/tests')
|
||||
)
|
||||
->setUsingCache(false);
|
||||
|
||||
74
README.md
74
README.md
@@ -3,14 +3,42 @@
|
||||
<h2>炸毛框架</h2>
|
||||
炸毛框架 (zhamao-framework) 是一个协程高性能的聊天机器人 + Web 服务器开发框架<br><br>
|
||||
|
||||
[](http://wpa.qq.com/msgrd?v=3&uin=627577391&site=qq&menu=yes)
|
||||
[](https://github.com/zhamao-robot/zhamao-framework/blob/master/LICENSE)
|
||||
[](https://packagist.org/packages/zhamao/framework)
|
||||
[](https://github.com/howmanybots/onebot)
|
||||

|
||||
<p align="center">
|
||||
<a href="https://onebot.dev/">
|
||||
<img src="https://img.shields.io/badge/OneBot-11-black?style=flat-square" alt="OneBot">
|
||||
</a>
|
||||
|
||||
[](https://github.com/zhamao-robot/zhamao-framework/search?q=AnnotationBase)
|
||||
[](https://github.com/zhamao-robot/zhamao-framework/search?q=TODO)
|
||||
<a href="https://github.com/zhamao-robot/zhamao-framework/actions">
|
||||
<img src="https://img.shields.io/github/workflow/status/zhamao-robot/zhamao-framework/Integration%20and%20Style%20Test?label=Test&style=flat-square" alt="Integration Test">
|
||||
</a>
|
||||
|
||||
<a href="https://packagist.org/packages/zhamao/framework">
|
||||
<img src="https://img.shields.io/packagist/dt/zhamao/framework?label=Downloads&style=flat-square" alt="下载数">
|
||||
</a>
|
||||
|
||||
<a href="https://github.com/zhamao-robot/zhamao-framework/releases">
|
||||
<img src="https://img.shields.io/packagist/v/zhamao/framework?include_prereleases&label=Release&style=flat-square" alt="最新版本">
|
||||
</a>
|
||||
|
||||
<a href="https://github.com/zhamao-robot/zhamao-framework/blob/master/LICENSE">
|
||||
<img src="https://img.shields.io/github/license/zhamao-robot/zhamao-framework?label=License&style=flat-square" alt="开源协议">
|
||||
</a>
|
||||
|
||||
<a href="https://wpa.qq.com/msgrd?v=3&uin=627577391&site=qq&menu=yes">
|
||||
<img src="https://img.shields.io/badge/作者QQ-627577391-orange?style=flat-square" alt="作者QQ">
|
||||
</a>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<a href="https://github.com/zhamao-robot/zhamao-framework/search?q=AnnotationBase">
|
||||
<img src="https://img.shields.io/github/search/zhamao-robot/zhamao-framework/AnnotationBase?label=Annotations&style=flat-square" alt="注解数量">
|
||||
</a>
|
||||
|
||||
<a href="https://github.com/zhamao-robot/zhamao-framework/search?q=TODO">
|
||||
<img src="https://img.shields.io/github/search/zhamao-robot/zhamao-framework/TODO?label=TODO&style=flat-square" alt="TODO">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -46,18 +74,32 @@ public function index() {
|
||||
|
||||
## 开始
|
||||
|
||||
如果你是初学者,可以直接使用以下脚本部署 PHP 环境和安装框架的脚手架:
|
||||
框架目前支持 Linux、WSL、macOS 环境直接运行,上述环境可直接使用下方一键安装脚本。
|
||||
|
||||
> 如果你想在其他环境安装部署,可使用 Docker、Cygwin,详见文档。
|
||||
|
||||
```bash
|
||||
# 新建一个自己喜欢名字的文件夹,运行一键安装脚本 (仅限 x86-64(AMD64) 和 AArch64(ARM64) 平台)
|
||||
mkdir zhamao-app/
|
||||
cd zhamao-app/
|
||||
# 默认安装的 PHP 版本为 7.4,如需使用其他版本,请设置环境变量 ZM_DOWN_PHP_VERSION 为对应的 PHP 版本,例如:
|
||||
# export ZM_DOWN_PHP_VERSION=8.1
|
||||
bash -c "$(curl -fsSL https://api.zhamao.xin/go.sh)"
|
||||
# 检测PHP环境、安装框架
|
||||
bash <(curl -fsSL https://zhamao.xin/go.sh)
|
||||
|
||||
# 启动
|
||||
./zhamao server:start
|
||||
# 启动框架
|
||||
cd zhamao-app
|
||||
./zhamao server
|
||||
```
|
||||
|
||||
一键安装脚本还有可以自定义参数的方式,比如:
|
||||
|
||||
```bash
|
||||
# 脚本默认会检测系统的PHP,如果想直接跳过检测,安装独立的PHP版本,则添加此环境变量
|
||||
export ZM_NO_LOCAL_PHP="yes"
|
||||
# 脚本如果安装独立版本PHP,默认版本为8.0,如果想使用其他版本,则添加此环境变量指定版本
|
||||
export ZM_DOWN_PHP_VERSION="8.1"
|
||||
# 脚本默认会将框架在当前目录下的 `zhamao-app` 目录进行安装,如果想使用其他目录,则添加此环境变量
|
||||
export ZM_CUSTOM_DIR="my-custom-app"
|
||||
# 脚本默认会对本项目使用阿里云国内加速镜像,如果想使用packagist源,则添加此环境变量
|
||||
export ZM_COMPOSER_PACKAGIST="yes"
|
||||
# 执行完前面的环境变量再执行一键安装脚本,就可以实现自定义参数!
|
||||
bash <(curl -fsSL https://zhamao.xin/go.sh)
|
||||
```
|
||||
|
||||
关于其他安装方式,请参阅[文档](https://framework.zhamao.xin/guide/installation.html) 。
|
||||
|
||||
401
bin/gendoc
Executable file
401
bin/gendoc
Executable file
@@ -0,0 +1,401 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 决定是否忽略该类
|
||||
*
|
||||
* @param ReflectionClass $class 准备生成的类的反射类
|
||||
*/
|
||||
function should_ignore_class(ReflectionClass $class): bool
|
||||
{
|
||||
// 注解类
|
||||
if (($doc = $class->getDocComment()) && strpos($doc, '@Annotation') !== false) {
|
||||
return true;
|
||||
}
|
||||
if (str_ends_with($class->getName(), 'Exception')) {
|
||||
return true;
|
||||
}
|
||||
if (str_contains($class->getName(), '_')) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (PHP_VERSION_ID < 70400) {
|
||||
echo 'PHP 版本必须为 7.4 或以上';
|
||||
exit(1);
|
||||
}
|
||||
|
||||
function check_composer_executable(string $composer): bool
|
||||
{
|
||||
passthru($composer . ' --version 2>/dev/null', $exit_code);
|
||||
return $exit_code === 0;
|
||||
}
|
||||
|
||||
function find_valid_root(string $current_dir, int $max_loop): string
|
||||
{
|
||||
if ($max_loop <= 0) {
|
||||
return '';
|
||||
}
|
||||
if (!file_exists($current_dir . '/composer.json')) {
|
||||
return find_valid_root(dirname($current_dir), $max_loop - 1);
|
||||
}
|
||||
return $current_dir;
|
||||
}
|
||||
|
||||
$root = find_valid_root(getcwd(), 3);
|
||||
if (empty($root)) {
|
||||
echo '找不到有效的根目录';
|
||||
exit(1);
|
||||
}
|
||||
echo '根目录: ' . $root . PHP_EOL;
|
||||
|
||||
chdir($root);
|
||||
|
||||
if (!is_dir($root . '/src/ZM')) {
|
||||
echo '源码目录不存在';
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$phpdoc_package_temp_installed = false;
|
||||
if (file_exists($root . '/vendor/jasny/phpdoc-parser/composer.json')) {
|
||||
echo '正在使用现有的 PHPDoc 解析库' . PHP_EOL;
|
||||
} else {
|
||||
echo 'PHPDoc 解析库不存在,正在尝试安装...' . PHP_EOL;
|
||||
echo '本次生成完成后将会自动移除' . PHP_EOL;
|
||||
$composers = [
|
||||
'runtime/composer', 'composer', 'php composer.phar',
|
||||
];
|
||||
foreach ($composers as $composer) {
|
||||
if (check_composer_executable($composer)) {
|
||||
echo '正在使用 ' . $composer . ' 安装 PHPDoc 解析库,请稍候...' . PHP_EOL;
|
||||
passthru("{$composer} require --quiet jasny/phpdoc-parser", $exit_code);
|
||||
if ($exit_code === 0) {
|
||||
$phpdoc_package_temp_installed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!$phpdoc_package_temp_installed) {
|
||||
echo '安装失败,请手动安装:composer require jasny/phpdoc-parser' . PHP_EOL;
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
// 从这里开始是主要生成逻辑
|
||||
|
||||
require_once $root . '/vendor/autoload.php';
|
||||
|
||||
use Jasny\PhpdocParser\PhpdocParser;
|
||||
use Jasny\PhpdocParser\Set\PhpDocumentor;
|
||||
use Jasny\PhpdocParser\Tag\Summery;
|
||||
use ZM\Console\Console;
|
||||
|
||||
$opts = getopt('', ['show-warnings', 'show-debug']);
|
||||
|
||||
if (array_key_exists('show-warnings', $opts)) {
|
||||
$show_warnings = true;
|
||||
} else {
|
||||
$show_warnings = false;
|
||||
}
|
||||
|
||||
Console::init(array_key_exists('show-debug', $opts) ? 4 : 2);
|
||||
|
||||
$errors = [];
|
||||
$warnings = [];
|
||||
|
||||
// 获取源码目录的文件遍历器
|
||||
$fs = new \RecursiveDirectoryIterator($root . '/src/ZM', FilesystemIterator::SKIP_DOTS);
|
||||
|
||||
// 初始化文档解析器
|
||||
$parser = new PhpdocParser(PhpDocumentor::tags()->with([
|
||||
new Summery(),
|
||||
]));
|
||||
|
||||
$metas = [];
|
||||
$class_count = 0;
|
||||
$method_count = 0;
|
||||
|
||||
function error(string $message)
|
||||
{
|
||||
global $errors;
|
||||
$errors[] = $message;
|
||||
Console::error($message);
|
||||
}
|
||||
|
||||
function warning(string $message)
|
||||
{
|
||||
global $warnings, $show_warnings;
|
||||
$warnings[] = $message;
|
||||
if ($show_warnings) {
|
||||
Console::warning($message);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取类的元数据
|
||||
*
|
||||
* 包括类的注释、方法的注释、参数、返回值等
|
||||
*/
|
||||
function get_class_metas(string $class_name, PhpdocParser $parser): array
|
||||
{
|
||||
// 尝试获取反射类
|
||||
try {
|
||||
$class = new \ReflectionClass($class_name);
|
||||
} catch (\ReflectionException $e) {
|
||||
error('无法获取类 ' . $class_name . ' 的反射类');
|
||||
return [];
|
||||
}
|
||||
|
||||
// 判断是否略过该类
|
||||
if (should_ignore_class($class)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$metas = [];
|
||||
|
||||
// 遍历类方法
|
||||
foreach ($class->getMethods() as $method) {
|
||||
if ($method->getDeclaringClass()->getName() !== $class_name) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Console::verbose('正在解析方法:' . $class_name . '::' . $method->getName());
|
||||
|
||||
// 获取方法的注释并解析
|
||||
$doc = $method->getDocComment();
|
||||
if (!$doc) {
|
||||
warning('找不到文档:' . $class_name . '::' . $method->getName());
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
$meta = $parser->parse($doc);
|
||||
} catch (\Exception $e) {
|
||||
error('解析失败:' . $class_name . '::' . $method->getName() . ',' . $e->getMessage());
|
||||
continue;
|
||||
}
|
||||
// 少数情况解析后会带有 */,需要去除
|
||||
array_walk_recursive($meta, static function (&$item) {
|
||||
if (is_string($item)) {
|
||||
$item = trim(str_replace('*/', '', $item));
|
||||
}
|
||||
});
|
||||
|
||||
// 对比反射方法获取的参数和注释声明的参数
|
||||
$parameters = $method->getParameters();
|
||||
$params_in_doc = $meta['params'] ?? [];
|
||||
|
||||
foreach ($parameters as $parameter) {
|
||||
$parameter_name = $parameter->getName();
|
||||
// 不存在则添加进参数列表中
|
||||
if (!isset($params_in_doc[$parameter_name])) {
|
||||
$params_in_doc[$parameter_name] = [
|
||||
'type' => $parameter->getType()?->getName(),
|
||||
'description' => '',
|
||||
];
|
||||
}
|
||||
}
|
||||
// 确保所有参数都有对应的类型和描述
|
||||
foreach ($params_in_doc as &$param) {
|
||||
if (!isset($param['type'])) {
|
||||
$param['type'] = 'mixed';
|
||||
}
|
||||
if (!isset($param['description'])) {
|
||||
$param['description'] = '';
|
||||
}
|
||||
}
|
||||
// 清除引用
|
||||
unset($param);
|
||||
$meta['params'] = $params_in_doc;
|
||||
|
||||
// 设定方法默认返回值
|
||||
if (!isset($meta['return'])) {
|
||||
$meta['return'] = [
|
||||
'type' => $method->getReturnType()?->getName() ?: 'mixed',
|
||||
'description' => '',
|
||||
];
|
||||
}
|
||||
|
||||
// 设定默认描述
|
||||
if (!isset($meta['return']['description'])) {
|
||||
$meta['return']['description'] = '';
|
||||
}
|
||||
|
||||
$metas[$method->getName()] = $meta;
|
||||
}
|
||||
|
||||
return $metas;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将方法的元数据转换为 Markdown 格式
|
||||
*
|
||||
* @param string $method 方法名
|
||||
* @param array $meta 元数据
|
||||
*/
|
||||
function convert_meta_to_markdown(string $method, array $meta): string
|
||||
{
|
||||
// 方法名作为标题
|
||||
$markdown = '## ' . $method . "\n\n";
|
||||
|
||||
// 构造方法代码块
|
||||
$markdown .= '```php' . "\n";
|
||||
// TODO: 适配 private 等修饰符
|
||||
$markdown .= 'public function ' . $method . '(';
|
||||
$params = [];
|
||||
// 添加参数
|
||||
foreach ($meta['params'] as $param_name => $param_meta) {
|
||||
$params[] = sprintf('%s $%s', $param_meta['type'] ?? 'mixed', $param_name);
|
||||
}
|
||||
$markdown .= implode(', ', $params) . ')';
|
||||
// 添加返回值
|
||||
$markdown .= ': ' . $meta['return']['type'];
|
||||
$markdown .= "\n```\n\n";
|
||||
|
||||
// 方法描述
|
||||
$markdown .= '### 描述' . "\n\n";
|
||||
$markdown .= ($meta['description'] ?? '作者很懒,什么也没有说') . "\n\n";
|
||||
|
||||
// 参数
|
||||
if (count($meta['params'])) {
|
||||
$markdown .= '### 参数' . "\n\n";
|
||||
$markdown .= '| 名称 | 类型 | 描述 |' . "\n";
|
||||
$markdown .= '| -------- | ---- | ----------- |' . "\n";
|
||||
foreach ($meta['params'] as $param_name => $param_meta) {
|
||||
$markdown .= '| ' . $param_name . ' | ' . $param_meta['type'] . ' | ' . $param_meta['description'] . ' |' . "\n";
|
||||
}
|
||||
$markdown .= "\n";
|
||||
}
|
||||
|
||||
// 返回值
|
||||
$markdown .= '### 返回' . "\n\n";
|
||||
$markdown .= '| 类型 | 描述 |' . "\n";
|
||||
$markdown .= '| ---- | ----------- |' . "\n";
|
||||
$markdown .= '| ' . $meta['return']['type'] . ' | ' . $meta['return']['description'] . ' |' . "\n";
|
||||
|
||||
return $markdown;
|
||||
}
|
||||
|
||||
function generate_sidebar_config(string $title, array $items): array
|
||||
{
|
||||
return [
|
||||
'title' => $title,
|
||||
'collapsable' => true,
|
||||
'children' => $items,
|
||||
];
|
||||
}
|
||||
|
||||
Console::info('开始生成!');
|
||||
|
||||
// 遍历类并将元数据添加至数组中
|
||||
foreach (new \RecursiveIteratorIterator($fs) as $file) {
|
||||
if (!$file->isFile()) {
|
||||
continue;
|
||||
}
|
||||
$path = $file->getPathname();
|
||||
|
||||
// 过滤不包含类的文件
|
||||
$tokens = token_get_all(file_get_contents($path));
|
||||
$found = false;
|
||||
foreach ($tokens as $k => $token) {
|
||||
if (!is_array($token)) {
|
||||
continue;
|
||||
}
|
||||
if ($token[0] === T_CLASS && $tokens[$k - 2][0] !== T_NEW) {
|
||||
$found = true;
|
||||
break;
|
||||
}
|
||||
if ($k >= 100) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$found) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 获取完整类名
|
||||
$path = ltrim($path, $root . '/');
|
||||
$class = str_replace(['.php', 'src/', '/'], ['', '', '\\'], $path);
|
||||
Console::verbose('正在解析类:' . $class);
|
||||
$meta = get_class_metas($class, $parser);
|
||||
// 忽略不包含任何方法的类
|
||||
if (empty($meta)) {
|
||||
continue;
|
||||
}
|
||||
$metas[$class] = $meta;
|
||||
++$class_count;
|
||||
$method_count += count($meta);
|
||||
}
|
||||
|
||||
// 将元数据转换为 Markdown
|
||||
$markdown = [];
|
||||
foreach ($metas as $class => $class_metas) {
|
||||
$markdown[$class] = [];
|
||||
// 将类名作为页面大标题
|
||||
$markdown[$class]['class'] = '# ' . $class;
|
||||
foreach ($class_metas as $method => $meta) {
|
||||
$markdown[$class][$method] = convert_meta_to_markdown($method, $meta);
|
||||
}
|
||||
}
|
||||
|
||||
// 生成文档
|
||||
$docs = $root . '/docs/api/';
|
||||
foreach ($markdown as $class => $methods) {
|
||||
$file = $docs . str_replace('\\', '/', $class) . '.md';
|
||||
// 确保目录存在
|
||||
if (!file_exists(dirname($file)) && !mkdir($concurrent_directory = dirname($file), 0777, true) && !is_dir($concurrent_directory)) {
|
||||
throw new \RuntimeException(sprintf('无法建立目录 %s', $concurrent_directory));
|
||||
}
|
||||
Console::verbose('正在生成文档:' . $file);
|
||||
$text = implode("\n\n", $methods);
|
||||
file_put_contents($file, $text);
|
||||
}
|
||||
|
||||
// 生成文档目录
|
||||
$children = array_keys($markdown);
|
||||
$children = str_replace('\\', '/', $children);
|
||||
$class_tree = [];
|
||||
foreach ($children as $child) {
|
||||
$parent = dirname($child);
|
||||
$class_tree[$parent][] = $child;
|
||||
}
|
||||
ksort($class_tree);
|
||||
$config = 'module.exports = [';
|
||||
foreach ($class_tree as $parent => $children) {
|
||||
$encode = json_encode(generate_sidebar_config($parent, $children));
|
||||
$encode = str_replace('\/', '/', $encode);
|
||||
$config .= $encode . ',';
|
||||
}
|
||||
$config = rtrim($config, ',');
|
||||
$config .= ']';
|
||||
|
||||
$file = $root . '/docs/.vuepress/api.js';
|
||||
file_put_contents($file, $config);
|
||||
|
||||
if (count($warnings)) {
|
||||
Console::warning('生成过程中发现 ' . count($warnings) . ' 次警告');
|
||||
if (!$show_warnings) {
|
||||
Console::info('生成器默认忽略了警告,你可以通过 gendoc --show-warnings 来查看警告');
|
||||
}
|
||||
}
|
||||
if (count($errors)) {
|
||||
Console::error('生成过程中发现错误:');
|
||||
foreach ($errors as $error) {
|
||||
Console::error($error);
|
||||
}
|
||||
}
|
||||
|
||||
Console::success('API 文档生成完毕');
|
||||
Console::success(sprintf('共生成 %d 个类,共 %d 个方法', $class_count, $method_count));
|
||||
|
||||
// 完成生成,进行善后
|
||||
|
||||
if ($phpdoc_package_temp_installed) {
|
||||
echo '正在移除 PHPDoc 解析库,请稍候...' . PHP_EOL;
|
||||
passthru('composer remove --quiet jasny/phpdoc-parser', $exit_code);
|
||||
if ($exit_code !== 0) {
|
||||
echo '移除失败,请手动移除:composer remove jasny/phpdoc-parser' . PHP_EOL;
|
||||
}
|
||||
echo '移除完成';
|
||||
}
|
||||
exit(0);
|
||||
142
bin/phpunit-swoole
Normal file → Executable file
142
bin/phpunit-swoole
Normal file → Executable file
@@ -1,69 +1,111 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
/**
|
||||
* Copyright: Swlib
|
||||
* Author: Twosee <twose@qq.com>
|
||||
* Date: 2018/4/14 下午10:58
|
||||
*/
|
||||
/** For Swoole coroutine tests */
|
||||
|
||||
// 如果改成 true,则会在终端显示所有炸毛框架的 Log
|
||||
const ZM_TEST_LOG_DEBUG = false;
|
||||
|
||||
use PHPUnit\Runner\Version;
|
||||
use PHPUnit\TextUI\TestRunner;
|
||||
use Swoole\Coroutine;
|
||||
use ZM\Annotation\Swoole\OnStart;
|
||||
use ZM\Command\RunServerCommand;
|
||||
use ZM\Console\Console;
|
||||
use ZM\ConsoleApplication;
|
||||
use ZM\Event\EventManager;
|
||||
use ZM\Framework;
|
||||
use ZM\Store\ZMAtomic;
|
||||
use ZM\Utils\ZMUtil;
|
||||
|
||||
$root = dirname(__DIR__);
|
||||
|
||||
Coroutine::set([
|
||||
'log_level' => SWOOLE_LOG_INFO,
|
||||
'trace_flags' => 0
|
||||
'trace_flags' => 0,
|
||||
]);
|
||||
|
||||
/*
|
||||
* This file is part of PHPUnit.
|
||||
*
|
||||
* (c) Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
if (PHP_VERSION_ID <= 70100) {
|
||||
fwrite(
|
||||
STDERR,
|
||||
sprintf(
|
||||
'This version of PHPUnit is supported on PHP 7.1 and above.' . PHP_EOL .
|
||||
'You are using PHP %s (%s).' . PHP_EOL,
|
||||
PHP_VERSION,
|
||||
PHP_BINARY
|
||||
)
|
||||
);
|
||||
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!ini_get('date.timezone')) {
|
||||
ini_set('date.timezone', 'Asia/Shanghai');
|
||||
}
|
||||
|
||||
foreach ([
|
||||
__DIR__ . '/../../../autoload.php',
|
||||
__DIR__ . '/../../autoload.php',
|
||||
__DIR__ . '/../vendor/autoload.php',
|
||||
__DIR__ . '/vendor/autoload.php'
|
||||
] as $file
|
||||
) {
|
||||
if (file_exists($file)) {
|
||||
define('PHPUNIT_COMPOSER_INSTALL', $file);
|
||||
break;
|
||||
}
|
||||
}
|
||||
require $root . '/vendor/autoload.php';
|
||||
|
||||
if (!defined('PHPUNIT_COMPOSER_INSTALL')) {
|
||||
fwrite(
|
||||
STDERR,
|
||||
'You need to set up the project dependencies using Composer:' . PHP_EOL . PHP_EOL .
|
||||
' composer install' . PHP_EOL . PHP_EOL .
|
||||
'You can learn all about Composer on https://getcomposer.org/.' . PHP_EOL
|
||||
);
|
||||
const ZM_VERSION_ID = ConsoleApplication::VERSION_ID;
|
||||
const ZM_VERSION = ConsoleApplication::VERSION;
|
||||
|
||||
die(1);
|
||||
} else {
|
||||
if (array_reverse(explode('/', __DIR__))[0] ?? '' === 'test') {
|
||||
$vendor_dir = dirname(PHPUNIT_COMPOSER_INSTALL);
|
||||
$bin_unit = "{$vendor_dir}/bin/phpunit";
|
||||
$unit_uint = "{$vendor_dir}/phpunit/phpunit/phpunit";
|
||||
if (file_exists($bin_unit)) {
|
||||
@unlink($bin_unit);
|
||||
@symlink(__FILE__, $bin_unit);
|
||||
}
|
||||
if (file_exists($unit_uint)) {
|
||||
@unlink($unit_uint);
|
||||
@symlink(__FILE__, $unit_uint);
|
||||
}
|
||||
// 模拟define
|
||||
const ZM_PROCESS_MASTER = 1;
|
||||
const ZM_PROCESS_MANAGER = 2;
|
||||
const ZM_PROCESS_WORKER = 4;
|
||||
const ZM_PROCESS_USER = 8;
|
||||
const ZM_PROCESS_TASKWORKER = 16;
|
||||
|
||||
define('FRAMEWORK_ROOT_DIR', $root);
|
||||
define('WORKING_DIR', $root);
|
||||
const SOURCE_ROOT_DIR = WORKING_DIR;
|
||||
define('LOAD_MODE', is_dir(SOURCE_ROOT_DIR . '/src/ZM') ? 0 : 1);
|
||||
chdir(__DIR__ . '/../');
|
||||
|
||||
$options = array_map(function ($x) {
|
||||
return $x->getDefault();
|
||||
}, RunServerCommand::exportDefinition()->getOptions());
|
||||
$options['disable-safe-exit'] = true;
|
||||
$options['worker-num'] = 1;
|
||||
$options['private-mode'] = true;
|
||||
$options['log-error'] = true;
|
||||
|
||||
spl_autoload_register(static function ($class) {
|
||||
$map = [
|
||||
TestRunner::class => 'vendor/phpunit/phpunit/src/TextUI/TestRunner.php',
|
||||
Version::class => 'vendor/phpunit/phpunit/src/Runner/Version.php',
|
||||
];
|
||||
if (isset($map[$class])) {
|
||||
$source = file_get_contents(SOURCE_ROOT_DIR . '/' . $map[$class]);
|
||||
$source = str_replace(['#StandWith', 'Ukraine', 'declare(strict_types=1);'], '', $source);
|
||||
eval('?>' . $source);
|
||||
}
|
||||
}
|
||||
/** @noinspection PhpIncludeInspection */
|
||||
require PHPUNIT_COMPOSER_INSTALL;
|
||||
$starttime = microtime(true);
|
||||
go(function () {
|
||||
}, true, true);
|
||||
|
||||
Console::setLevel(0);
|
||||
$framework = new Framework($options);
|
||||
$start = new OnStart();
|
||||
$start->method = function () {
|
||||
try {
|
||||
require_once __DIR__.'/../test/bootstrap.php';
|
||||
PHPUnit\TextUI\Command::main(false);
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage() . PHP_EOL;
|
||||
Console::setLevel(ZM_TEST_LOG_DEBUG ? 4 : 0);
|
||||
$retcode = PHPUnit\TextUI\Command::main(false);
|
||||
} finally {
|
||||
Console::setLevel(0);
|
||||
ZMUtil::stop(($retcode ?? 1) !== 0);
|
||||
}
|
||||
});
|
||||
};
|
||||
EventManager::addEvent(OnStart::class, $start);
|
||||
|
||||
$framework->start();
|
||||
|
||||
Swoole\Event::wait();
|
||||
echo "Took " . round(microtime(true) - $starttime, 4) . "s\n";
|
||||
if (ZMAtomic::get('stop_signal')->get() === 2) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -1,38 +1,17 @@
|
||||
{
|
||||
"name": "zhamao/framework",
|
||||
"description": "High performance chat robot and web server development framework",
|
||||
"minimum-stability": "stable",
|
||||
"license": "Apache-2.0",
|
||||
"extra": {
|
||||
"zm": {
|
||||
"exclude-annotation-path": [
|
||||
"src/ZM"
|
||||
]
|
||||
},
|
||||
"hooks": {
|
||||
"post-merge": "composer install",
|
||||
"pre-commit": [
|
||||
"echo committing as $(git config user.name)",
|
||||
"./vendor/bin/php-cs-fixer fix --dry-run --diff ./src"
|
||||
],
|
||||
"pre-push": [
|
||||
"./vendor/bin/php-cs-fixer fix --dry-run --diff ./src",
|
||||
"composer analyse"
|
||||
]
|
||||
}
|
||||
},
|
||||
"authors": [
|
||||
{
|
||||
"name": "jerry",
|
||||
"email": "admin@zhamao.me"
|
||||
},
|
||||
{
|
||||
"name": "sunxyw",
|
||||
"email": "dev@sunxyw.xyz"
|
||||
}
|
||||
],
|
||||
"prefer-stable": true,
|
||||
"bin": [
|
||||
"bin/start",
|
||||
"bin/phpunit-swoole",
|
||||
"bin/watcher"
|
||||
],
|
||||
"require": {
|
||||
"php": "^7.2 || ^7.3 || ^7.4 || ^8.0 || ^8.1",
|
||||
"ext-json": "*",
|
||||
@@ -41,17 +20,27 @@
|
||||
"dragonmantank/cron-expression": "^3.3",
|
||||
"jelix/version": "^2.0",
|
||||
"koriym/attributes": "^1.0",
|
||||
"psr/container": "^2.0",
|
||||
"psy/psysh": "^0.11.2",
|
||||
"symfony/console": "~5.0 || ~4.0 || ~3.0",
|
||||
"symfony/console": "~6.0 || ~5.0 || ~4.0 || ~3.0",
|
||||
"symfony/polyfill-ctype": "^1.19",
|
||||
"symfony/polyfill-mbstring": "^1.19",
|
||||
"symfony/polyfill-php80": "^1.16",
|
||||
"symfony/routing": "~5.0 || ~4.0 || ~3.0",
|
||||
"symfony/routing": "~6.0 || ~5.0 || ~4.0 || ~3.0",
|
||||
"zhamao/config": "^1.0",
|
||||
"zhamao/connection-manager": "^1.0",
|
||||
"zhamao/console": "^1.0",
|
||||
"zhamao/request": "^1.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"brainmaestro/composer-git-hooks": "^2.8",
|
||||
"friendsofphp/php-cs-fixer": "^3.2 != 3.7.0",
|
||||
"jetbrains/phpstorm-attributes": "^1.0",
|
||||
"phpstan/phpstan": "^1.1",
|
||||
"phpunit/phpunit": "^8.5 || ^9.0",
|
||||
"roave/security-advisories": "dev-latest",
|
||||
"swoole/ide-helper": "^4.5"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-ctype": "Use C/C++ extension instead of polyfill will be more efficient",
|
||||
"ext-mbstring": "Use C/C++ extension instead of polyfill will be more efficient",
|
||||
@@ -59,6 +48,8 @@
|
||||
"ext-redis": "If you use Redis in framework, you will need this extension",
|
||||
"league/climate": "Display columns and status in terminal"
|
||||
},
|
||||
"minimum-stability": "stable",
|
||||
"prefer-stable": true,
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"ZM\\": "src/ZM"
|
||||
@@ -70,25 +61,47 @@
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Module\\": "src/Module",
|
||||
"Custom\\": "src/Custom"
|
||||
"Custom\\": "src/Custom",
|
||||
"Tests\\": "tests"
|
||||
}
|
||||
},
|
||||
"bin": [
|
||||
"bin/gendoc",
|
||||
"bin/phpunit-swoole",
|
||||
"bin/start"
|
||||
],
|
||||
"config": {
|
||||
"optimize-autoloader": true,
|
||||
"sort-packages": true
|
||||
"sort-packages": true,
|
||||
"allow-plugins": {
|
||||
"phpstan/extension-installer": true
|
||||
}
|
||||
},
|
||||
"require-dev": {
|
||||
"brainmaestro/composer-git-hooks": "^2.8",
|
||||
"friendsofphp/php-cs-fixer": "^3.2 != 3.7.0",
|
||||
"phpstan/phpstan": "^1.1",
|
||||
"phpunit/phpunit": "^8.5 || ^9.0",
|
||||
"swoole/ide-helper": "^4.5"
|
||||
"extra": {
|
||||
"hooks": {
|
||||
"post-merge": "composer install",
|
||||
"pre-commit": [
|
||||
"echo committing as $(git config user.name)",
|
||||
"composer cs-fix -- --diff"
|
||||
],
|
||||
"pre-push": [
|
||||
"composer cs-fix -- --dry-run --diff",
|
||||
"composer analyse"
|
||||
]
|
||||
},
|
||||
"zm": {
|
||||
"exclude-annotation-path": [
|
||||
"src/ZM",
|
||||
"tests"
|
||||
]
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"post-install-cmd": [
|
||||
"[ $COMPOSER_DEV_MODE -eq 0 ] || vendor/bin/cghooks add"
|
||||
],
|
||||
"analyse": "phpstan analyse --memory-limit 300M -l 0 ./src",
|
||||
"cs-fix": "php-cs-fixer fix $1"
|
||||
"analyse": "phpstan analyse --memory-limit 300M",
|
||||
"cs-fix": "php-cs-fixer fix",
|
||||
"test": "bin/phpunit-swoole --no-coverage"
|
||||
}
|
||||
}
|
||||
|
||||
1
docs/.vuepress/api.js
Normal file
1
docs/.vuepress/api.js
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = [{"title":"ZM","collapsable":true,"children":["ZM/ZMServer"]},{"title":"ZM/API","collapsable":true,"children":["ZM/API/GoCqhttpAPIV11","ZM/API/TuringAPI","ZM/API/OneBotV11","ZM/API/ZMRobot","ZM/API/CQ"]},{"title":"ZM/API/Proxies/Bot","collapsable":true,"children":["ZM/API/Proxies/Bot/AbstractBotProxy","ZM/API/Proxies/Bot/AllGroupsProxy","ZM/API/Proxies/Bot/AllBotsProxy"]},{"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/WorkerContainer","ZM/Container/Container","ZM/Container/BoundMethod"]},{"title":"ZM/DB","collapsable":true,"children":["ZM/DB/SelectBody","ZM/DB/InsertBody","ZM/DB/Table","ZM/DB/DB","ZM/DB/UpdateBody","ZM/DB/DeleteBody"]},{"title":"ZM/Event","collapsable":true,"children":["ZM/Event/EventTracer","ZM/Event/EventDispatcher","ZM/Event/EventManager"]},{"title":"ZM/Event/SwooleEvent","collapsable":true,"children":["ZM/Event/SwooleEvent/OnMessage","ZM/Event/SwooleEvent/OnTask"]},{"title":"ZM/Http","collapsable":true,"children":["ZM/Http/Response"]},{"title":"ZM/Module","collapsable":true,"children":["ZM/Module/ModulePacker","ZM/Module/ModuleUnpacker","ZM/Module/ModuleBase"]},{"title":"ZM/MySQL","collapsable":true,"children":["ZM/MySQL/MySQLConnection","ZM/MySQL/MySQLStatement","ZM/MySQL/MySQLWrapper","ZM/MySQL/MySQLPool","ZM/MySQL/MySQLQueryBuilder","ZM/MySQL/MySQLStatementWrapper"]},{"title":"ZM/Store","collapsable":true,"children":["ZM/Store/ZMAtomic","ZM/Store/LightCache","ZM/Store/LightCacheInside"]},{"title":"ZM/Store/Redis","collapsable":true,"children":["ZM/Store/Redis/ZMRedis"]},{"title":"ZM/Utils","collapsable":true,"children":["ZM/Utils/SignalListener","ZM/Utils/MessageUtil","ZM/Utils/CommandInfoUtil","ZM/Utils/ReflectionUtil","ZM/Utils/Terminal","ZM/Utils/CoMessage","ZM/Utils/DataProvider","ZM/Utils/HttpUtil"]},{"title":"ZM/Utils/Manager","collapsable":true,"children":["ZM/Utils/Manager/WorkerManager","ZM/Utils/Manager/CronManager","ZM/Utils/Manager/ModuleManager"]}]
|
||||
@@ -4,7 +4,7 @@
|
||||
<div v-for="i in chat" v-bind="i">
|
||||
<div class="doc-chat-row" v-if="i.type === 0">
|
||||
<div class="doc-chat-box">{{ i.content }}</div>
|
||||
<img class="doc-chat-avatar" src="http://api.btstu.cn/sjtx/api.php" alt=""/>
|
||||
<img class="doc-chat-avatar" src="https://api.btstu.cn/sjtx/api.php" alt=""/>
|
||||
</div>
|
||||
<div class="doc-chat-row doc-chat-row-robot" v-else-if="i.type === 1">
|
||||
<img class="doc-chat-avatar" src="https://docs-v1.zhamao.xin/logo.png" alt=""/>
|
||||
@@ -138,4 +138,4 @@ export default {
|
||||
height: 36px !important;
|
||||
border-radius: 18px;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
const apiConfig = require('./api')
|
||||
|
||||
module.exports = {
|
||||
title: '炸毛框架',
|
||||
description: '一个聊天机器人 + Web 框架',
|
||||
description: '一个高性能聊天机器人 + Web 框架',
|
||||
theme: 'antdocs',
|
||||
markdown: {
|
||||
lineNumbers: true
|
||||
@@ -29,6 +31,7 @@ module.exports = {
|
||||
{ text: '事件和注解', link: '/event/' },
|
||||
{ text: '组件', link: '/component/' },
|
||||
{ text: '进阶', link: '/advanced/' },
|
||||
{ text: 'API', link: '/api/' },
|
||||
{ text: 'FAQ', link: '/faq/' },
|
||||
{ text: '更新日志', link: '/update/v2/' },
|
||||
{ text: '炸毛框架 v1', link: 'https://docs-v1.zhamao.xin/' }
|
||||
@@ -161,6 +164,7 @@ module.exports = {
|
||||
]
|
||||
},
|
||||
],
|
||||
'/api/': apiConfig,
|
||||
'/faq/': [
|
||||
'',
|
||||
'to-v2',
|
||||
@@ -185,4 +189,4 @@ module.exports = {
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,17 +21,16 @@ footer: |
|
||||
|
||||
## 安装框架和环境
|
||||
|
||||
此命令可一键以模板安装 `zhamao-framework` 和 `PHP` 独立环境到目录下,无需 root!(仅限 Linux)
|
||||
此命令可一键以模板安装框架!(仅限 Linux 和 macOS)
|
||||
|
||||
```bash
|
||||
mkdir my-app
|
||||
cd my-app
|
||||
bash -c "$(curl -fsSL https://api.zhamao.xin/go.sh)"
|
||||
bash <(curl -fsSL https://zhamao.xin/go.sh)
|
||||
```
|
||||
|
||||
## 运行框架
|
||||
|
||||
```bash
|
||||
cd zhamao-app/
|
||||
./zhamao server
|
||||
```
|
||||
|
||||
|
||||
618
docs/api/ZM/API/CQ.md
Normal file
618
docs/api/ZM/API/CQ.md
Normal file
@@ -0,0 +1,618 @@
|
||||
# ZM\API\CQ
|
||||
|
||||
## at
|
||||
|
||||
```php
|
||||
public function at(int|string $qq): string
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
at一下QQ用户(仅在QQ群支持at全体)
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| qq | int|string | 用户QQ号/ID号 |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| string | CQ码 |
|
||||
|
||||
|
||||
## face
|
||||
|
||||
```php
|
||||
public function face(int|string $id): string
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
发送QQ原生表情
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| id | int|string | 表情ID |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| string | CQ码 |
|
||||
|
||||
|
||||
## image
|
||||
|
||||
```php
|
||||
public function image(string $file, bool $cache, bool $flash, bool $proxy, int $timeout): string
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
发送图片
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| file | string | 文件的路径、URL或者base64编码的图片数据 |
|
||||
| cache | bool | 是否缓存(默认为true) |
|
||||
| flash | bool | 是否闪照(默认为false) |
|
||||
| proxy | bool | 是否使用代理(默认为true) |
|
||||
| timeout | int | 超时时间(默认不超时) |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| string | CQ码 |
|
||||
|
||||
|
||||
## record
|
||||
|
||||
```php
|
||||
public function record(string $file, bool $magic, bool $cache, bool $proxy, int $timeout): string
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
发送语音
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| file | string | 文件的路径、URL或者base64编码的语音数据 |
|
||||
| magic | bool | 是否加特技(默认为false) |
|
||||
| cache | bool | 是否缓存(默认为true) |
|
||||
| proxy | bool | 是否使用代理(默认为true) |
|
||||
| timeout | int | 超时时间(默认不超时) |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| string | CQ码 |
|
||||
|
||||
|
||||
## video
|
||||
|
||||
```php
|
||||
public function video(string $file, bool $cache, bool $proxy, int $timeout): string
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
发送短视频
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| file | string | 文件的路径、URL或者base64编码的短视频数据 |
|
||||
| cache | bool | 是否缓存(默认为true) |
|
||||
| proxy | bool | 是否使用代理(默认为true) |
|
||||
| timeout | int | 超时时间(默认不超时) |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| string | CQ码 |
|
||||
|
||||
|
||||
## rps
|
||||
|
||||
```php
|
||||
public function rps(): string
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
发送投掷骰子(只能在单条回复中单独使用)
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| string | CQ码 |
|
||||
|
||||
|
||||
## dice
|
||||
|
||||
```php
|
||||
public function dice(): string
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
发送掷骰子表情(只能在单条回复中单独使用)
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| string | CQ码 |
|
||||
|
||||
|
||||
## shake
|
||||
|
||||
```php
|
||||
public function shake(): string
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
戳一戳(原窗口抖动,仅支持好友消息使用)
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| string | CQ码 |
|
||||
|
||||
|
||||
## poke
|
||||
|
||||
```php
|
||||
public function poke(int|string $type, int|string $id, string $name): string
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
发送新的戳一戳
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| type | int|string | 焯一戳类型 |
|
||||
| id | int|string | 戳一戳ID号 |
|
||||
| name | string | 戳一戳名称(可选) |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| string | CQ码 |
|
||||
|
||||
|
||||
## anonymous
|
||||
|
||||
```php
|
||||
public function anonymous(int $ignore): string
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
发送匿名消息
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| ignore | int | 是否忽略错误(默认为1,0表示不忽略错误) |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| string | CQ码 |
|
||||
|
||||
|
||||
## share
|
||||
|
||||
```php
|
||||
public function share(string $url, string $title, null|string $content, null|string $image): string
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
发送链接分享(只能在单条回复中单独使用)
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| url | string | 分享地址 |
|
||||
| title | string | 标题 |
|
||||
| content | null|string | 卡片内容(可选) |
|
||||
| image | null|string | 卡片图片(可选) |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| string | CQ码 |
|
||||
|
||||
|
||||
## contact
|
||||
|
||||
```php
|
||||
public function contact(int|string $type, int|string $id): string
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
发送好友或群推荐名片
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| type | int|string | 名片类型 |
|
||||
| id | int|string | 好友或群ID |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| string | CQ码 |
|
||||
|
||||
|
||||
## location
|
||||
|
||||
```php
|
||||
public function location(float|string $lat, float|string $lon, string $title, string $content): string
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
发送位置
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| lat | float|string | 纬度 |
|
||||
| lon | float|string | 经度 |
|
||||
| title | string | 标题(可选) |
|
||||
| content | string | 卡片内容(可选) |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| string | CQ码 |
|
||||
|
||||
|
||||
## music
|
||||
|
||||
```php
|
||||
public function music(string $type, int|string $id_or_url, null|string $audio, null|string $title, null|string $content, null|string $image): string
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
发送音乐分享(只能在单条回复中单独使用)
|
||||
qq、163、xiami为内置分享,需要先通过搜索功能获取id后使用
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| type | string | 分享类型(仅限 `qq`、`163`、`xiami` 或 `custom`) |
|
||||
| id_or_url | int|string | 当分享类型不是 `custom` 时,表示的是分享音乐的ID(需要先通过搜索功能获取id后使用),反之表示的是音乐卡片点入的链接 |
|
||||
| audio | null|string | 当分享类型是 `custom` 时,表示为音乐(如mp3文件)的HTTP链接地址(不可为空) |
|
||||
| title | null|string | 当分享类型是 `custom` 时,表示为音乐卡片的标题,建议12字以内(不可为空) |
|
||||
| content | null|string | 当分享类型是 `custom` 时,表示为音乐卡片的简介(可忽略) |
|
||||
| image | null|string | 当分享类型是 `custom` 时,表示为音乐卡片的图片链接地址(可忽略) |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| string | CQ码 |
|
||||
|
||||
|
||||
## forward
|
||||
|
||||
```php
|
||||
public function forward(int|string $id): string
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
合并转发消息
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| id | int|string | 合并转发ID, 需要通过 `/get_forward_msg` API获取转发的具体内容 |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| string | CQ码 |
|
||||
|
||||
|
||||
## node
|
||||
|
||||
```php
|
||||
public function node(int|string $user_id, string $nickname, string $content): string
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
合并转发消息节点
|
||||
特殊说明: 需要使用单独的API /send_group_forward_msg 发送, 并且由于消息段较为复杂, 仅支持Array形式入参。
|
||||
如果引用消息和自定义消息同时出现, 实际查看顺序将取消息段顺序。
|
||||
另外按 CQHTTP 文档说明, data 应全为字符串, 但由于需要接收message 类型的消息, 所以 仅限此Type的content字段 支持Array套娃
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| user_id | int|string | 转发消息id |
|
||||
| nickname | string | 发送者显示名字 |
|
||||
| content | string | 具体消息 |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| string | CQ码 |
|
||||
|
||||
|
||||
## xml
|
||||
|
||||
```php
|
||||
public function xml(string $data): string
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
XML消息
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| data | string | xml内容, xml中的value部分 |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| string | CQ码 |
|
||||
|
||||
|
||||
## json
|
||||
|
||||
```php
|
||||
public function json(string $data, int $resid): string
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
JSON消息
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| data | string | json内容 |
|
||||
| resid | int | 0为走小程序通道,其他值为富文本通道(默认为0) |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| string | CQ码 |
|
||||
|
||||
|
||||
## _custom
|
||||
|
||||
```php
|
||||
public function _custom(string $type_name, array $params): string
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
返回一个自定义扩展的CQ码(支持自定义类型和参数)
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| type_name | string | CQ码类型名称 |
|
||||
| params | array | 参数 |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| string | CQ码 |
|
||||
|
||||
|
||||
## decode
|
||||
|
||||
```php
|
||||
public function decode(int|string|Stringable $msg, bool $is_content): string
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
反转义字符串中的CQ码敏感符号
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| msg | int|string|Stringable | 字符串 |
|
||||
| is_content | bool | 如果是解码CQ码本体内容,则为false(默认),如果是参数内的字符串,则为true |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| string | 转义后的CQ码 |
|
||||
|
||||
|
||||
## replace
|
||||
|
||||
```php
|
||||
public function replace(int|string|Stringable $str): string
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
简单反转义替换CQ码的方括号
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| str | int|string|Stringable | 字符串 |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| string | 字符串 |
|
||||
|
||||
|
||||
## escape
|
||||
|
||||
```php
|
||||
public function escape(int|string|Stringable $msg, bool $is_content): string
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
转义CQ码的特殊字符,同encode
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| msg | int|string|Stringable | 字符串 |
|
||||
| is_content | bool | 如果是转义CQ码本体内容,则为false(默认),如果是参数内的字符串,则为true |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| string | 转义后的CQ码 |
|
||||
|
||||
|
||||
## encode
|
||||
|
||||
```php
|
||||
public function encode(int|string|Stringable $msg, bool $is_content): string
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
转义CQ码的特殊字符
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| msg | int|string|Stringable | 字符串 |
|
||||
| is_content | bool | 如果是转义CQ码本体内容,则为false(默认),如果是参数内的字符串,则为true |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| string | 转义后的CQ码 |
|
||||
|
||||
|
||||
## removeCQ
|
||||
|
||||
```php
|
||||
public function removeCQ(string $msg): string
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
移除消息中所有的CQ码并返回移除CQ码后的消息
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| msg | string | 消息 |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| string | 消息内容 |
|
||||
|
||||
|
||||
## getCQ
|
||||
|
||||
```php
|
||||
public function getCQ(string $msg, bool $is_object): null|array|CQObject
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
获取消息中第一个CQ码
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| msg | string | 消息内容 |
|
||||
| is_object | bool | 是否以对象形式返回,如果为False的话,返回数组形式(默认为false) |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| null|array|CQObject | 返回的CQ码(数组或对象) |
|
||||
|
||||
|
||||
## getAllCQ
|
||||
|
||||
```php
|
||||
public function getAllCQ(string $msg, bool $is_object): array|CQObject[]
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
获取消息中所有的CQ码
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| msg | string | 消息内容 |
|
||||
| is_object | bool | 是否以对象形式返回,如果为False的话,返回数组形式(默认为false) |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| array|CQObject[] | 返回的CQ码们(数组或对象) |
|
||||
130
docs/api/ZM/API/GoCqhttpAPIV11.md
Normal file
130
docs/api/ZM/API/GoCqhttpAPIV11.md
Normal file
@@ -0,0 +1,130 @@
|
||||
# ZM\API\GoCqhttpAPIV11
|
||||
|
||||
## getGuildServiceProfile
|
||||
|
||||
```php
|
||||
public function getGuildServiceProfile(): array|bool
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
获取频道系统内BOT的资料
|
||||
响应字段:nickname, tiny_id, avatar_url
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| array|bool | 返回API调用结果(数组)或异步API调用状态(bool) |
|
||||
|
||||
|
||||
## getGuildList
|
||||
|
||||
```php
|
||||
public function getGuildList(): array|bool
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
获取频道列表
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| array|bool | 返回API调用结果(数组)或异步API调用状态(bool) |
|
||||
|
||||
|
||||
## getGuildMetaByGuest
|
||||
|
||||
```php
|
||||
public function getGuildMetaByGuest(int|string $guild_id): array|bool
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
通过访客获取频道元数据
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| guild_id | int|string | 频道ID |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| array|bool | 返回API调用结果(数组)或异步API调用状态(bool) |
|
||||
|
||||
|
||||
## getGuildChannelList
|
||||
|
||||
```php
|
||||
public function getGuildChannelList(int|string $guild_id, false $no_cache): array|bool
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
获取子频道列表
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| guild_id | int|string | 频道ID |
|
||||
| no_cache | false | 禁用缓存(默认为false) |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| array|bool | 返回API调用结果(数组)或异步API调用状态(bool) |
|
||||
|
||||
|
||||
## getGuildMembers
|
||||
|
||||
```php
|
||||
public function getGuildMembers(int|string $guild_id): array|bool
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
获取频道成员列表
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| guild_id | int|string | 频道ID |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| array|bool | 返回API调用结果(数组)或异步API调用状态(bool) |
|
||||
|
||||
|
||||
## sendGuildChannelMsg
|
||||
|
||||
```php
|
||||
public function sendGuildChannelMsg(int|string $guild_id, int|string $channel_id, string $message): array|bool
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
发送信息到子频道
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| guild_id | int|string | 频道ID |
|
||||
| channel_id | int|string | 子频道ID |
|
||||
| message | string | 信息内容 |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| array|bool | 返回API调用结果(数组)或异步API调用状态(bool) |
|
||||
984
docs/api/ZM/API/OneBotV11.md
Normal file
984
docs/api/ZM/API/OneBotV11.md
Normal file
@@ -0,0 +1,984 @@
|
||||
# ZM\API\OneBotV11
|
||||
|
||||
## get
|
||||
|
||||
```php
|
||||
public function get(int|string $robot_id): ZMRobot
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
获取机器人Action/API实例
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| robot_id | int|string | 机器人ID |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| ZMRobot | 机器人实例 |
|
||||
|
||||
|
||||
## getRandom
|
||||
|
||||
```php
|
||||
public function getRandom(): ZMRobot
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
随机获取一个连接到框架的机器人实例
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| ZMRobot | 机器人实例 |
|
||||
|
||||
|
||||
## getAllRobot
|
||||
|
||||
```php
|
||||
public function getAllRobot(): ZMRobot[]
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
获取所有机器人实例
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| ZMRobot[] | 机器人实例们 |
|
||||
|
||||
|
||||
## setCallback
|
||||
|
||||
```php
|
||||
public function setCallback(bool|Closure $callback): OneBotV11
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
设置回调或启用协程等待API回包
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| callback | bool|Closure | 是否开启协程或设置异步回调函数,如果为true,则协程等待结果,如果为false,则异步执行并不等待结果,如果为回调函数,则异步执行且调用回调 |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| OneBotV11 | 返回本身 |
|
||||
|
||||
|
||||
## setPrefix
|
||||
|
||||
```php
|
||||
public function setPrefix(int $prefix): OneBotV11
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
设置API调用类型后缀
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| prefix | int | 设置后缀类型,API_NORMAL为不加后缀,API_ASYNC为异步调用,API_RATE_LIMITED为加后缀并且限制调用频率 |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| OneBotV11 | 返回本身 |
|
||||
|
||||
|
||||
## sendPrivateMsg
|
||||
|
||||
```php
|
||||
public function sendPrivateMsg(int|string $user_id, string $message, bool $auto_escape): array|bool
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
发送私聊消息
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| user_id | int|string | 用户ID |
|
||||
| message | string | 消息内容 |
|
||||
| auto_escape | bool | 是否自动转义(默认为false) |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| array|bool | 返回API调用结果(数组)或异步API调用状态(bool) |
|
||||
|
||||
|
||||
## sendGroupMsg
|
||||
|
||||
```php
|
||||
public function sendGroupMsg(int|string $group_id, string $message, bool $auto_escape): array|bool
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
发送群消息
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| group_id | int|string | 群组ID |
|
||||
| message | string | 消息内容 |
|
||||
| auto_escape | bool | 是否自动转义(默认为false) |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| array|bool | 返回API调用结果(数组)或异步API调用状态(bool) |
|
||||
|
||||
|
||||
## sendMsg
|
||||
|
||||
```php
|
||||
public function sendMsg(string $message_type, int|string $target_id, string $message, bool $auto_escape): array|bool
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
发送消息
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| message_type | string | 消息类型 |
|
||||
| target_id | int|string | 目标ID |
|
||||
| message | string | 消息内容 |
|
||||
| auto_escape | bool | 是否自动转义(默认为false) |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| array|bool | 返回API调用结果(数组)或异步API调用状态(bool) |
|
||||
|
||||
|
||||
## deleteMsg
|
||||
|
||||
```php
|
||||
public function deleteMsg(int|string $message_id): array|bool
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
撤回消息
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| message_id | int|string | 消息ID |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| array|bool | 返回API调用结果(数组)或异步API调用状态(bool) |
|
||||
|
||||
|
||||
## getMsg
|
||||
|
||||
```php
|
||||
public function getMsg(int|string $message_id): array|bool
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
获取消息
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| message_id | int|string | 消息ID |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| array|bool | 返回API调用结果(数组)或异步API调用状态(bool) |
|
||||
|
||||
|
||||
## getForwardMsg
|
||||
|
||||
```php
|
||||
public function getForwardMsg(int|string $id): array|bool
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
获取合并转发消息
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| id | int|string | ID |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| array|bool | 返回API调用结果(数组)或异步API调用状态(bool) |
|
||||
|
||||
|
||||
## sendLike
|
||||
|
||||
```php
|
||||
public function sendLike(int|string $user_id, int $times): array|bool
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
发送好友赞
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| user_id | int|string | 用户ID |
|
||||
| times | int | 时间 |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| array|bool | 返回API调用结果(数组)或异步API调用状态(bool) |
|
||||
|
||||
|
||||
## setGroupKick
|
||||
|
||||
```php
|
||||
public function setGroupKick(int|string $group_id, int|string $user_id, bool $reject_add_request): array|bool
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
群组踢人
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| group_id | int|string | 群ID |
|
||||
| user_id | int|string | 用户ID |
|
||||
| reject_add_request | bool | |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| array|bool | 返回API调用结果(数组)或异步API调用状态(bool) |
|
||||
|
||||
|
||||
## setGroupBan
|
||||
|
||||
```php
|
||||
public function setGroupBan(int|string $group_id, int|string $user_id, int $duration): array|bool
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
群组单人禁言
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| group_id | int|string | 群ID |
|
||||
| user_id | int|string | 用户ID |
|
||||
| duration | int | 禁言时长 |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| array|bool | 返回API调用结果(数组)或异步API调用状态(bool) |
|
||||
|
||||
|
||||
## setGroupAnonymousBan
|
||||
|
||||
```php
|
||||
public function setGroupAnonymousBan(int|string $group_id, array|int|string $anonymous_or_flag, int $duration): array|bool
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
群组匿名用户禁言
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| group_id | int|string | 群ID |
|
||||
| anonymous_or_flag | array|int|string | 匿名禁言Flag或匿名用户对象 |
|
||||
| duration | int | |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| array|bool | 返回API调用结果(数组)或异步API调用状态(bool) |
|
||||
|
||||
|
||||
## setGroupWholeBan
|
||||
|
||||
```php
|
||||
public function setGroupWholeBan(int|string $group_id, bool $enable): array|bool
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
群组全员禁言
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| group_id | int|string | 群ID |
|
||||
| enable | bool | |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| array|bool | 返回API调用结果(数组)或异步API调用状态(bool) |
|
||||
|
||||
|
||||
## setGroupAdmin
|
||||
|
||||
```php
|
||||
public function setGroupAdmin(int|string $group_id, int|string $user_id, bool $enable): array|bool
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
群组设置管理员
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| group_id | int|string | 群ID |
|
||||
| user_id | int|string | 用户ID |
|
||||
| enable | bool | |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| array|bool | 返回API调用结果(数组)或异步API调用状态(bool) |
|
||||
|
||||
|
||||
## setGroupAnonymous
|
||||
|
||||
```php
|
||||
public function setGroupAnonymous(int|string $group_id, bool $enable): array|bool
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
群组匿名
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| group_id | int|string | 群ID |
|
||||
| enable | bool | 是否启用(默认为true) |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| array|bool | 返回API调用结果(数组)或异步API调用状态(bool) |
|
||||
|
||||
|
||||
## setGroupCard
|
||||
|
||||
```php
|
||||
public function setGroupCard(int|string $group_id, int|string $user_id, string $card): array|bool
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
设置群名片(群备注)
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| group_id | int|string | 群ID |
|
||||
| user_id | int|string | 用户ID |
|
||||
| card | string | 名片内容(默认为空) |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| array|bool | 返回API调用结果(数组)或异步API调用状态(bool) |
|
||||
|
||||
|
||||
## setGroupName
|
||||
|
||||
```php
|
||||
public function setGroupName(int|string $group_id, string $group_name): array|bool
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
设置群名
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| group_id | int|string | 群ID |
|
||||
| group_name | string | 群名 |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| array|bool | 返回API调用结果(数组)或异步API调用状态(bool) |
|
||||
|
||||
|
||||
## setGroupLeave
|
||||
|
||||
```php
|
||||
public function setGroupLeave(int|string $group_id, bool $is_dismiss): array|bool
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
退出群组
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| group_id | int|string | 群ID |
|
||||
| is_dismiss | bool | 是否解散(默认为false) |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| array|bool | 返回API调用结果(数组)或异步API调用状态(bool) |
|
||||
|
||||
|
||||
## setGroupSpecialTitle
|
||||
|
||||
```php
|
||||
public function setGroupSpecialTitle(int|string $group_id, int|string $user_id, string $special_title, int $duration): array|bool
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
设置群组专属头衔
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| group_id | int|string | 群ID |
|
||||
| user_id | int|string | 用户ID |
|
||||
| special_title | string | 专属头衔内容 |
|
||||
| duration | int | 持续时间(默认为-1,永久) |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| array|bool | 返回API调用结果(数组)或异步API调用状态(bool) |
|
||||
|
||||
|
||||
## setFriendAddRequest
|
||||
|
||||
```php
|
||||
public function setFriendAddRequest(array|int|string $flag, bool $approve, string $remark): array|bool
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
处理加好友请求
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| flag | array|int|string | 处理加好友请求的flag |
|
||||
| approve | bool | 是否同意(默认为true) |
|
||||
| remark | string | 设置昵称(默认不设置) |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| array|bool | 返回API调用结果(数组)或异步API调用状态(bool) |
|
||||
|
||||
|
||||
## setGroupAddRequest
|
||||
|
||||
```php
|
||||
public function setGroupAddRequest(array|int|string $flag, string $sub_type, bool $approve, string $reason): array|bool
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
处理加群请求/邀请
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| flag | array|int|string | 处理加群请求的flag |
|
||||
| sub_type | string | 处理请求类型(包含add和invite) |
|
||||
| approve | bool | 是否同意(默认为true) |
|
||||
| reason | string | 拒绝理由(仅在拒绝时有效,默认为空) |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| array|bool | 返回API调用结果(数组)或异步API调用状态(bool) |
|
||||
|
||||
|
||||
## getLoginInfo
|
||||
|
||||
```php
|
||||
public function getLoginInfo(): array|bool
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
获取登录号信息
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| array|bool | 返回API调用结果(数组)或异步API调用状态(bool) |
|
||||
|
||||
|
||||
## getStrangerInfo
|
||||
|
||||
```php
|
||||
public function getStrangerInfo(int|string $user_id, bool $no_cache): array|bool
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
获取陌生人信息
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| user_id | int|string | 用户ID |
|
||||
| no_cache | bool | 是否不使用缓存(默认为false) |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| array|bool | 返回API调用结果(数组)或异步API调用状态(bool) |
|
||||
|
||||
|
||||
## getFriendList
|
||||
|
||||
```php
|
||||
public function getFriendList(): array|bool
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
获取好友列表
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| array|bool | 返回API调用结果(数组)或异步API调用状态(bool) |
|
||||
|
||||
|
||||
## getGroupInfo
|
||||
|
||||
```php
|
||||
public function getGroupInfo(int|string $group_id, bool $no_cache): array|bool
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
获取群信息
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| group_id | int|string | 群ID |
|
||||
| no_cache | bool | |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| array|bool | 返回API调用结果(数组)或异步API调用状态(bool) |
|
||||
|
||||
|
||||
## getGroupList
|
||||
|
||||
```php
|
||||
public function getGroupList(): array|bool
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
获取群列表
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| array|bool | 返回API调用结果(数组)或异步API调用状态(bool) |
|
||||
|
||||
|
||||
## getGroupMemberInfo
|
||||
|
||||
```php
|
||||
public function getGroupMemberInfo(int|string $group_id, int|string $user_id, bool $no_cache): array|bool
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
获取群成员信息
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| group_id | int|string | 群ID |
|
||||
| user_id | int|string | 用户ID |
|
||||
| no_cache | bool | |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| array|bool | 返回API调用结果(数组)或异步API调用状态(bool) |
|
||||
|
||||
|
||||
## getGroupMemberList
|
||||
|
||||
```php
|
||||
public function getGroupMemberList(int|string $group_id): array|bool
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
获取群成员列表
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| group_id | int|string | 群ID |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| array|bool | 返回API调用结果(数组)或异步API调用状态(bool) |
|
||||
|
||||
|
||||
## getGroupHonorInfo
|
||||
|
||||
```php
|
||||
public function getGroupHonorInfo(int|string $group_id, string $type): array|bool
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
获取群荣誉信息
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| group_id | int|string | 群ID |
|
||||
| type | string | 荣誉类型 |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| array|bool | 返回API调用结果(数组)或异步API调用状态(bool) |
|
||||
|
||||
|
||||
## getCsrfToken
|
||||
|
||||
```php
|
||||
public function getCsrfToken(): array|bool
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
获取 CSRF Token
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| array|bool | 返回API调用结果(数组)或异步API调用状态(bool) |
|
||||
|
||||
|
||||
## getCredentials
|
||||
|
||||
```php
|
||||
public function getCredentials(string $domain): array|bool
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
获取 QQ 相关接口凭证
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| domain | string | |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| array|bool | 返回API调用结果(数组)或异步API调用状态(bool) |
|
||||
|
||||
|
||||
## getRecord
|
||||
|
||||
```php
|
||||
public function getRecord(string $file, string $out_format): array|bool
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
获取语音
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| file | string | 文件 |
|
||||
| out_format | string | 输出格式 |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| array|bool | 返回API调用结果(数组)或异步API调用状态(bool) |
|
||||
|
||||
|
||||
## getImage
|
||||
|
||||
```php
|
||||
public function getImage(string $file): array|bool
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
获取图片
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| file | string | 文件 |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| array|bool | 返回API调用结果(数组)或异步API调用状态(bool) |
|
||||
|
||||
|
||||
## canSendImage
|
||||
|
||||
```php
|
||||
public function canSendImage(): array|bool
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
检查是否可以发送图片
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| array|bool | 返回API调用结果(数组)或异步API调用状态(bool) |
|
||||
|
||||
|
||||
## canSendRecord
|
||||
|
||||
```php
|
||||
public function canSendRecord(): array|bool
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
检查是否可以发送语音
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| array|bool | 返回API调用结果(数组)或异步API调用状态(bool) |
|
||||
|
||||
|
||||
## getStatus
|
||||
|
||||
```php
|
||||
public function getStatus(): array|bool
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
获取运行状态
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| array|bool | 返回API调用结果(数组)或异步API调用状态(bool) |
|
||||
|
||||
|
||||
## getVersionInfo
|
||||
|
||||
```php
|
||||
public function getVersionInfo(): array|bool
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
获取版本信息
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| array|bool | 返回API调用结果(数组)或异步API调用状态(bool) |
|
||||
|
||||
|
||||
## setRestart
|
||||
|
||||
```php
|
||||
public function setRestart(int $delay): array|bool
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
重启 OneBot 实现
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| delay | int | 延迟时间(毫秒,默认为0) |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| array|bool | 返回API调用结果(数组)或异步API调用状态(bool) |
|
||||
|
||||
|
||||
## cleanCache
|
||||
|
||||
```php
|
||||
public function cleanCache(): array|bool
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
清理缓存
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| array|bool | 返回API调用结果(数组)或异步API调用状态(bool) |
|
||||
|
||||
|
||||
## getExtendedAPI
|
||||
|
||||
```php
|
||||
public function getExtendedAPI(string $package_name): mixed
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
获取内置支持的扩展API对象
|
||||
现支持 go-cqhttp 的扩展API
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| package_name | string | |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| mixed | 返回包的操作对象 |
|
||||
|
||||
|
||||
## callExtendedAPI
|
||||
|
||||
```php
|
||||
public function callExtendedAPI(string $action, array $params): array|bool
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
作者很懒,什么也没有说
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| action | string | 动作(API)名称 |
|
||||
| params | array | 参数 |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| array|bool | 返回API调用结果(数组)或异步API调用状态(bool) |
|
||||
117
docs/api/ZM/API/Proxies/Bot/AbstractBotProxy.md
Normal file
117
docs/api/ZM/API/Proxies/Bot/AbstractBotProxy.md
Normal file
@@ -0,0 +1,117 @@
|
||||
# ZM\API\Proxies\Bot\AbstractBotProxy
|
||||
|
||||
## __construct
|
||||
|
||||
```php
|
||||
public function __construct(AbstractBotProxy|ZMRobot $bot): mixed
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
构造函数
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| bot | AbstractBotProxy|ZMRobot | 调用此代理的机器人实例 |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| mixed | |
|
||||
|
||||
|
||||
## __call
|
||||
|
||||
```php
|
||||
public function __call(string $name, array $arguments): mixed
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
在传入的机器人实例上调用方法
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| name | string | 方法名 |
|
||||
| arguments | array | 参数 |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| mixed | |
|
||||
|
||||
|
||||
## __get
|
||||
|
||||
```php
|
||||
public function __get(string $name): mixed
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
获取传入的机器人实例的属性
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| name | string | 属性名 |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| mixed | |
|
||||
|
||||
|
||||
## __set
|
||||
|
||||
```php
|
||||
public function __set(string $name, mixed $value): mixed
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
设置传入的机器人实例的属性
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| name | string | 属性名 |
|
||||
| value | mixed | 属性值 |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| mixed | |
|
||||
|
||||
|
||||
## __isset
|
||||
|
||||
```php
|
||||
public function __isset(string $name): bool
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
判断传入的机器人实例的属性是否存在
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| name | string | 属性名 |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| bool | |
|
||||
24
docs/api/ZM/API/Proxies/Bot/AllBotsProxy.md
Normal file
24
docs/api/ZM/API/Proxies/Bot/AllBotsProxy.md
Normal file
@@ -0,0 +1,24 @@
|
||||
# ZM\API\Proxies\Bot\AllBotsProxy
|
||||
|
||||
## __call
|
||||
|
||||
```php
|
||||
public function __call(string $name, array $arguments): array<mixed>
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
在所有机器人实例上调用方法
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| name | string | 方法名 |
|
||||
| arguments | array | 参数 |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| array<mixed> | 返回一个包含所有执行结果的数组,键名为机器人ID |
|
||||
24
docs/api/ZM/API/Proxies/Bot/AllGroupsProxy.md
Normal file
24
docs/api/ZM/API/Proxies/Bot/AllGroupsProxy.md
Normal file
@@ -0,0 +1,24 @@
|
||||
# ZM\API\Proxies\Bot\AllGroupsProxy
|
||||
|
||||
## __call
|
||||
|
||||
```php
|
||||
public function __call(string $name, array $arguments): array<mixed>
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
在传入的机器人实例上调用方法
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| name | string | 方法名 |
|
||||
| arguments | array | 参数 |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| array<mixed> | 返回一个包含所有执行结果的数组,键名为群号 |
|
||||
48
docs/api/ZM/API/TuringAPI.md
Normal file
48
docs/api/ZM/API/TuringAPI.md
Normal file
@@ -0,0 +1,48 @@
|
||||
# ZM\API\TuringAPI
|
||||
|
||||
## getTuringMsg
|
||||
|
||||
```php
|
||||
public function getTuringMsg(string $msg, int|string $user_id, string $api): string
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
请求图灵API,返回图灵的消息
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| msg | string | 消息 |
|
||||
| user_id | int|string | 用户ID |
|
||||
| api | string | API Key |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| string | 图灵的回复 |
|
||||
|
||||
|
||||
## getResultStatus
|
||||
|
||||
```php
|
||||
public function getResultStatus(array $r): bool|string
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
作者很懒,什么也没有说
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| r | array | 数据API回包 |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| bool|string | 错误消息或成功鸥鸟 |
|
||||
46
docs/api/ZM/API/ZMRobot.md
Normal file
46
docs/api/ZM/API/ZMRobot.md
Normal file
@@ -0,0 +1,46 @@
|
||||
# ZM\API\ZMRobot
|
||||
|
||||
## all
|
||||
|
||||
```php
|
||||
public function all(ZM\API\Proxies\Bot\AbstractBotProxy $proxy): ZM\API\Proxies\Bot\AllBotsProxy
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
获取一个会在所有机器人实例上执行的代理
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| proxy | ZM\API\Proxies\Bot\AbstractBotProxy | |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| ZM\API\Proxies\Bot\AllBotsProxy | |
|
||||
|
||||
|
||||
## allGroups
|
||||
|
||||
```php
|
||||
public function allGroups(ZM\API\Proxies\Bot\AbstractBotProxy $proxy): ZM\API\Proxies\Bot\AllGroupsProxy
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
获取一个会在所有群上执行的代理
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| proxy | ZM\API\Proxies\Bot\AbstractBotProxy | |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| ZM\API\Proxies\Bot\AllGroupsProxy | |
|
||||
1
docs/api/ZM/Annotation/AnnotationBase.md
Normal file
1
docs/api/ZM/Annotation/AnnotationBase.md
Normal file
@@ -0,0 +1 @@
|
||||
# ZM\Annotation\AnnotationBase
|
||||
100
docs/api/ZM/Annotation/AnnotationParser.md
Normal file
100
docs/api/ZM/Annotation/AnnotationParser.md
Normal file
@@ -0,0 +1,100 @@
|
||||
# ZM\Annotation\AnnotationParser
|
||||
|
||||
## __construct
|
||||
|
||||
```php
|
||||
public function __construct(): mixed
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
AnnotationParser constructor.
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| mixed | |
|
||||
|
||||
|
||||
## registerMods
|
||||
|
||||
```php
|
||||
public function registerMods(): mixed
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
注册各个模块类的注解和模块level的排序
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| mixed | |
|
||||
|
||||
|
||||
## addRegisterPath
|
||||
|
||||
```php
|
||||
public function addRegisterPath(string $path, string $indoor_name): mixed
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
作者很懒,什么也没有说
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| path | string | 注册解析注解的路径 |
|
||||
| indoor_name | string | 起始命名空间的名称 |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| mixed | |
|
||||
|
||||
|
||||
## sortByLevel
|
||||
|
||||
```php
|
||||
public function sortByLevel(array $events, string $class_name, string $prefix): mixed
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
作者很懒,什么也没有说
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| events | array | 需要排序的 |
|
||||
| class_name | string | 排序的类名 |
|
||||
| prefix | string | 前缀 |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| mixed | |
|
||||
|
||||
|
||||
## verifyMiddlewares
|
||||
|
||||
```php
|
||||
public function verifyMiddlewares(): mixed
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
作者很懒,什么也没有说
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| mixed | |
|
||||
1
docs/api/ZM/Annotation/CQ/CQAPIResponse.md
Normal file
1
docs/api/ZM/Annotation/CQ/CQAPIResponse.md
Normal file
@@ -0,0 +1 @@
|
||||
# ZM\Annotation\CQ\CQAPIResponse
|
||||
39
docs/api/ZM/Annotation/CQ/CQAfter.md
Normal file
39
docs/api/ZM/Annotation/CQ/CQAfter.md
Normal file
@@ -0,0 +1,39 @@
|
||||
# ZM\Annotation\CQ\CQAfter
|
||||
|
||||
## getLevel
|
||||
|
||||
```php
|
||||
public function getLevel(): mixed
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
作者很懒,什么也没有说
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| mixed | |
|
||||
|
||||
|
||||
## setLevel
|
||||
|
||||
```php
|
||||
public function setLevel(mixed $level): mixed
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
作者很懒,什么也没有说
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| level | mixed | |
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| mixed | |
|
||||
39
docs/api/ZM/Annotation/CQ/CQBefore.md
Normal file
39
docs/api/ZM/Annotation/CQ/CQBefore.md
Normal file
@@ -0,0 +1,39 @@
|
||||
# ZM\Annotation\CQ\CQBefore
|
||||
|
||||
## getLevel
|
||||
|
||||
```php
|
||||
public function getLevel(): mixed
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
作者很懒,什么也没有说
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| mixed | |
|
||||
|
||||
|
||||
## setLevel
|
||||
|
||||
```php
|
||||
public function setLevel(mixed $level): mixed
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
作者很懒,什么也没有说
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| level | mixed | |
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| mixed | |
|
||||
22
docs/api/ZM/Annotation/CQ/CQCommand.md
Normal file
22
docs/api/ZM/Annotation/CQ/CQCommand.md
Normal file
@@ -0,0 +1,22 @@
|
||||
# ZM\Annotation\CQ\CQCommand
|
||||
|
||||
## setLevel
|
||||
|
||||
```php
|
||||
public function setLevel(int $level): mixed
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
作者很懒,什么也没有说
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| level | int | |
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| mixed | |
|
||||
1
docs/api/ZM/Annotation/CQ/CQMessage.md
Normal file
1
docs/api/ZM/Annotation/CQ/CQMessage.md
Normal file
@@ -0,0 +1 @@
|
||||
# ZM\Annotation\CQ\CQMessage
|
||||
39
docs/api/ZM/Annotation/CQ/CQMetaEvent.md
Normal file
39
docs/api/ZM/Annotation/CQ/CQMetaEvent.md
Normal file
@@ -0,0 +1,39 @@
|
||||
# ZM\Annotation\CQ\CQMetaEvent
|
||||
|
||||
## getLevel
|
||||
|
||||
```php
|
||||
public function getLevel(): mixed
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
作者很懒,什么也没有说
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| mixed | |
|
||||
|
||||
|
||||
## setLevel
|
||||
|
||||
```php
|
||||
public function setLevel(int $level): mixed
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
作者很懒,什么也没有说
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| level | int | |
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| mixed | |
|
||||
22
docs/api/ZM/Annotation/CQ/CQNotice.md
Normal file
22
docs/api/ZM/Annotation/CQ/CQNotice.md
Normal file
@@ -0,0 +1,22 @@
|
||||
# ZM\Annotation\CQ\CQNotice
|
||||
|
||||
## setLevel
|
||||
|
||||
```php
|
||||
public function setLevel(int $level): mixed
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
作者很懒,什么也没有说
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| level | int | |
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| mixed | |
|
||||
22
docs/api/ZM/Annotation/CQ/CQRequest.md
Normal file
22
docs/api/ZM/Annotation/CQ/CQRequest.md
Normal file
@@ -0,0 +1,22 @@
|
||||
# ZM\Annotation\CQ\CQRequest
|
||||
|
||||
## setLevel
|
||||
|
||||
```php
|
||||
public function setLevel(int $level): mixed
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
作者很懒,什么也没有说
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| level | int | |
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| mixed | |
|
||||
1
docs/api/ZM/Annotation/Command/TerminalCommand.md
Normal file
1
docs/api/ZM/Annotation/Command/TerminalCommand.md
Normal file
@@ -0,0 +1 @@
|
||||
# ZM\Annotation\Command\TerminalCommand
|
||||
61
docs/api/ZM/Annotation/Cron/Cron.md
Normal file
61
docs/api/ZM/Annotation/Cron/Cron.md
Normal file
@@ -0,0 +1,61 @@
|
||||
# ZM\Annotation\Cron\Cron
|
||||
|
||||
## setStatus
|
||||
|
||||
```php
|
||||
public function setStatus(int $status): void
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
作者很懒,什么也没有说
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| status | int | |
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| void | |
|
||||
|
||||
|
||||
## getRecordNextTime
|
||||
|
||||
```php
|
||||
public function getRecordNextTime(): int
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
作者很懒,什么也没有说
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| int | |
|
||||
|
||||
|
||||
## setRecordNextTime
|
||||
|
||||
```php
|
||||
public function setRecordNextTime(int $record_next_time): void
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
作者很懒,什么也没有说
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| record_next_time | int | |
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| void | |
|
||||
1
docs/api/ZM/Annotation/Http/Controller.md
Normal file
1
docs/api/ZM/Annotation/Http/Controller.md
Normal file
@@ -0,0 +1 @@
|
||||
# ZM\Annotation\Http\Controller
|
||||
1
docs/api/ZM/Annotation/Http/HandleAfter.md
Normal file
1
docs/api/ZM/Annotation/Http/HandleAfter.md
Normal file
@@ -0,0 +1 @@
|
||||
# ZM\Annotation\Http\HandleAfter
|
||||
1
docs/api/ZM/Annotation/Http/HandleBefore.md
Normal file
1
docs/api/ZM/Annotation/Http/HandleBefore.md
Normal file
@@ -0,0 +1 @@
|
||||
# ZM\Annotation\Http\HandleBefore
|
||||
1
docs/api/ZM/Annotation/Http/HandleException.md
Normal file
1
docs/api/ZM/Annotation/Http/HandleException.md
Normal file
@@ -0,0 +1 @@
|
||||
# ZM\Annotation\Http\HandleException
|
||||
1
docs/api/ZM/Annotation/Http/Middleware.md
Normal file
1
docs/api/ZM/Annotation/Http/Middleware.md
Normal file
@@ -0,0 +1 @@
|
||||
# ZM\Annotation\Http\Middleware
|
||||
1
docs/api/ZM/Annotation/Http/MiddlewareClass.md
Normal file
1
docs/api/ZM/Annotation/Http/MiddlewareClass.md
Normal file
@@ -0,0 +1 @@
|
||||
# ZM\Annotation\Http\MiddlewareClass
|
||||
1
docs/api/ZM/Annotation/Http/RequestMapping.md
Normal file
1
docs/api/ZM/Annotation/Http/RequestMapping.md
Normal file
@@ -0,0 +1 @@
|
||||
# ZM\Annotation\Http\RequestMapping
|
||||
1
docs/api/ZM/Annotation/Http/RequestMethod.md
Normal file
1
docs/api/ZM/Annotation/Http/RequestMethod.md
Normal file
@@ -0,0 +1 @@
|
||||
# ZM\Annotation\Http\RequestMethod
|
||||
1
docs/api/ZM/Annotation/Module/Closed.md
Normal file
1
docs/api/ZM/Annotation/Module/Closed.md
Normal file
@@ -0,0 +1 @@
|
||||
# ZM\Annotation\Module\Closed
|
||||
1
docs/api/ZM/Annotation/Swoole/OnCloseEvent.md
Normal file
1
docs/api/ZM/Annotation/Swoole/OnCloseEvent.md
Normal file
@@ -0,0 +1 @@
|
||||
# ZM\Annotation\Swoole\OnCloseEvent
|
||||
1
docs/api/ZM/Annotation/Swoole/OnManagerStartEvent.md
Normal file
1
docs/api/ZM/Annotation/Swoole/OnManagerStartEvent.md
Normal file
@@ -0,0 +1 @@
|
||||
# ZM\Annotation\Swoole\OnManagerStartEvent
|
||||
1
docs/api/ZM/Annotation/Swoole/OnMessageEvent.md
Normal file
1
docs/api/ZM/Annotation/Swoole/OnMessageEvent.md
Normal file
@@ -0,0 +1 @@
|
||||
# ZM\Annotation\Swoole\OnMessageEvent
|
||||
1
docs/api/ZM/Annotation/Swoole/OnOpenEvent.md
Normal file
1
docs/api/ZM/Annotation/Swoole/OnOpenEvent.md
Normal file
@@ -0,0 +1 @@
|
||||
# ZM\Annotation\Swoole\OnOpenEvent
|
||||
1
docs/api/ZM/Annotation/Swoole/OnPipeMessageEvent.md
Normal file
1
docs/api/ZM/Annotation/Swoole/OnPipeMessageEvent.md
Normal file
@@ -0,0 +1 @@
|
||||
# ZM\Annotation\Swoole\OnPipeMessageEvent
|
||||
1
docs/api/ZM/Annotation/Swoole/OnRequestEvent.md
Normal file
1
docs/api/ZM/Annotation/Swoole/OnRequestEvent.md
Normal file
@@ -0,0 +1 @@
|
||||
# ZM\Annotation\Swoole\OnRequestEvent
|
||||
1
docs/api/ZM/Annotation/Swoole/OnSave.md
Normal file
1
docs/api/ZM/Annotation/Swoole/OnSave.md
Normal file
@@ -0,0 +1 @@
|
||||
# ZM\Annotation\Swoole\OnSave
|
||||
1
docs/api/ZM/Annotation/Swoole/OnSetup.md
Normal file
1
docs/api/ZM/Annotation/Swoole/OnSetup.md
Normal file
@@ -0,0 +1 @@
|
||||
# ZM\Annotation\Swoole\OnSetup
|
||||
1
docs/api/ZM/Annotation/Swoole/OnStart.md
Normal file
1
docs/api/ZM/Annotation/Swoole/OnStart.md
Normal file
@@ -0,0 +1 @@
|
||||
# ZM\Annotation\Swoole\OnStart
|
||||
1
docs/api/ZM/Annotation/Swoole/OnSwooleEvent.md
Normal file
1
docs/api/ZM/Annotation/Swoole/OnSwooleEvent.md
Normal file
@@ -0,0 +1 @@
|
||||
# ZM\Annotation\Swoole\OnSwooleEvent
|
||||
23
docs/api/ZM/Annotation/Swoole/OnSwooleEventBase.md
Normal file
23
docs/api/ZM/Annotation/Swoole/OnSwooleEventBase.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# ZM\Annotation\Swoole\OnSwooleEventBase
|
||||
|
||||
## setLevel
|
||||
|
||||
```php
|
||||
public function setLevel(int $level): mixed
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
作者很懒,什么也没有说
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| level | int | |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| mixed | |
|
||||
17
docs/api/ZM/Annotation/Swoole/OnTask.md
Normal file
17
docs/api/ZM/Annotation/Swoole/OnTask.md
Normal file
@@ -0,0 +1,17 @@
|
||||
# ZM\Annotation\Swoole\OnTask
|
||||
|
||||
## getRule
|
||||
|
||||
```php
|
||||
public function getRule(): mixed
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
作者很懒,什么也没有说
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| mixed | |
|
||||
1
docs/api/ZM/Annotation/Swoole/OnTaskEvent.md
Normal file
1
docs/api/ZM/Annotation/Swoole/OnTaskEvent.md
Normal file
@@ -0,0 +1 @@
|
||||
# ZM\Annotation\Swoole\OnTaskEvent
|
||||
1
docs/api/ZM/Annotation/Swoole/OnTick.md
Normal file
1
docs/api/ZM/Annotation/Swoole/OnTick.md
Normal file
@@ -0,0 +1 @@
|
||||
# ZM\Annotation\Swoole\OnTick
|
||||
1
docs/api/ZM/Annotation/Swoole/SwooleHandler.md
Normal file
1
docs/api/ZM/Annotation/Swoole/SwooleHandler.md
Normal file
@@ -0,0 +1 @@
|
||||
# ZM\Annotation\Swoole\SwooleHandler
|
||||
1
docs/api/ZM/Command/BuildCommand.md
Normal file
1
docs/api/ZM/Command/BuildCommand.md
Normal file
@@ -0,0 +1 @@
|
||||
# ZM\Command\BuildCommand
|
||||
25
docs/api/ZM/Command/CheckConfigCommand.md
Normal file
25
docs/api/ZM/Command/CheckConfigCommand.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# ZM\Command\CheckConfigCommand
|
||||
|
||||
## check
|
||||
|
||||
```php
|
||||
public function check(mixed $remote, mixed $local, Symfony\Component\Console\Output\OutputInterface $out): mixed
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
作者很懒,什么也没有说
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| remote | mixed | |
|
||||
| local | mixed | |
|
||||
| out | Symfony\Component\Console\Output\OutputInterface | |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| mixed | |
|
||||
1
docs/api/ZM/Command/Daemon/DaemonCommand.md
Normal file
1
docs/api/ZM/Command/Daemon/DaemonCommand.md
Normal file
@@ -0,0 +1 @@
|
||||
# ZM\Command\Daemon\DaemonCommand
|
||||
1
docs/api/ZM/Command/Daemon/DaemonReloadCommand.md
Normal file
1
docs/api/ZM/Command/Daemon/DaemonReloadCommand.md
Normal file
@@ -0,0 +1 @@
|
||||
# ZM\Command\Daemon\DaemonReloadCommand
|
||||
1
docs/api/ZM/Command/Daemon/DaemonStatusCommand.md
Normal file
1
docs/api/ZM/Command/Daemon/DaemonStatusCommand.md
Normal file
@@ -0,0 +1 @@
|
||||
# ZM\Command\Daemon\DaemonStatusCommand
|
||||
1
docs/api/ZM/Command/Daemon/DaemonStopCommand.md
Normal file
1
docs/api/ZM/Command/Daemon/DaemonStopCommand.md
Normal file
@@ -0,0 +1 @@
|
||||
# ZM\Command\Daemon\DaemonStopCommand
|
||||
91
docs/api/ZM/Command/Generate/APIDocsGenerateCommand.md
Normal file
91
docs/api/ZM/Command/Generate/APIDocsGenerateCommand.md
Normal file
@@ -0,0 +1,91 @@
|
||||
# ZM\Command\Generate\APIDocsGenerateCommand
|
||||
|
||||
## configure
|
||||
|
||||
```php
|
||||
public function configure(): void
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
Configures the current command.
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| void | |
|
||||
|
||||
|
||||
## execute
|
||||
|
||||
```php
|
||||
public function execute(Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output): int
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
Executes the current command.
|
||||
This method is not abstract because you can use this class
|
||||
as a concrete class. In this case, instead of defining the
|
||||
execute() method, you set the code to execute by passing
|
||||
a Closure to the setCode() method.
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| input | Symfony\Component\Console\Input\InputInterface | |
|
||||
| output | Symfony\Component\Console\Output\OutputInterface | |
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| int | 0 if everything went fine, or an exit code * |
|
||||
|
||||
|
||||
## getClassMetas
|
||||
|
||||
```php
|
||||
public function getClassMetas(string $class_name, Jasny\PhpdocParser\PhpdocParser $parser): array
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
获取类的元数据
|
||||
包括类的注释、方法的注释、参数、返回值等
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| class_name | string | |
|
||||
| parser | Jasny\PhpdocParser\PhpdocParser | |
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| array | |
|
||||
|
||||
|
||||
## convertMetaToMarkdown
|
||||
|
||||
```php
|
||||
public function convertMetaToMarkdown(string $method, array $meta): string
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
将方法的元数据转换为 Markdown 格式
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| method | string | 方法名 |
|
||||
| meta | array | 元数据 |
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| string | |
|
||||
1
docs/api/ZM/Command/Generate/SystemdGenerateCommand.md
Normal file
1
docs/api/ZM/Command/Generate/SystemdGenerateCommand.md
Normal file
@@ -0,0 +1 @@
|
||||
# ZM\Command\Generate\SystemdGenerateCommand
|
||||
1
docs/api/ZM/Command/InitCommand.md
Normal file
1
docs/api/ZM/Command/InitCommand.md
Normal file
@@ -0,0 +1 @@
|
||||
# ZM\Command\InitCommand
|
||||
24
docs/api/ZM/Command/Module/ModuleListCommand.md
Normal file
24
docs/api/ZM/Command/Module/ModuleListCommand.md
Normal file
@@ -0,0 +1,24 @@
|
||||
# ZM\Command\Module\ModuleListCommand
|
||||
|
||||
## execute
|
||||
|
||||
```php
|
||||
public function execute(Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output): int
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
作者很懒,什么也没有说
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| input | Symfony\Component\Console\Input\InputInterface | |
|
||||
| output | Symfony\Component\Console\Output\OutputInterface | |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| int | |
|
||||
24
docs/api/ZM/Command/Module/ModulePackCommand.md
Normal file
24
docs/api/ZM/Command/Module/ModulePackCommand.md
Normal file
@@ -0,0 +1,24 @@
|
||||
# ZM\Command\Module\ModulePackCommand
|
||||
|
||||
## execute
|
||||
|
||||
```php
|
||||
public function execute(Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output): int
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
作者很懒,什么也没有说
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| input | Symfony\Component\Console\Input\InputInterface | |
|
||||
| output | Symfony\Component\Console\Output\OutputInterface | |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| int | |
|
||||
1
docs/api/ZM/Command/Module/ModuleUnpackCommand.md
Normal file
1
docs/api/ZM/Command/Module/ModuleUnpackCommand.md
Normal file
@@ -0,0 +1 @@
|
||||
# ZM\Command\Module\ModuleUnpackCommand
|
||||
1
docs/api/ZM/Command/PureHttpCommand.md
Normal file
1
docs/api/ZM/Command/PureHttpCommand.md
Normal file
@@ -0,0 +1 @@
|
||||
# ZM\Command\PureHttpCommand
|
||||
1
docs/api/ZM/Command/RunServerCommand.md
Normal file
1
docs/api/ZM/Command/RunServerCommand.md
Normal file
@@ -0,0 +1 @@
|
||||
# ZM\Command\RunServerCommand
|
||||
1
docs/api/ZM/Command/Server/ServerReloadCommand.md
Normal file
1
docs/api/ZM/Command/Server/ServerReloadCommand.md
Normal file
@@ -0,0 +1 @@
|
||||
# ZM\Command\Server\ServerReloadCommand
|
||||
1
docs/api/ZM/Command/Server/ServerStatusCommand.md
Normal file
1
docs/api/ZM/Command/Server/ServerStatusCommand.md
Normal file
@@ -0,0 +1 @@
|
||||
# ZM\Command\Server\ServerStatusCommand
|
||||
1
docs/api/ZM/Command/Server/ServerStopCommand.md
Normal file
1
docs/api/ZM/Command/Server/ServerStopCommand.md
Normal file
@@ -0,0 +1 @@
|
||||
# ZM\Command\Server\ServerStopCommand
|
||||
46
docs/api/ZM/ConsoleApplication.md
Normal file
46
docs/api/ZM/ConsoleApplication.md
Normal file
@@ -0,0 +1,46 @@
|
||||
# ZM\ConsoleApplication
|
||||
|
||||
## __construct
|
||||
|
||||
```php
|
||||
public function __construct(string $name): mixed
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
作者很懒,什么也没有说
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| name | string | |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| mixed | |
|
||||
|
||||
|
||||
## initEnv
|
||||
|
||||
```php
|
||||
public function initEnv(string $with_default_cmd): ZM\ConsoleApplication
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
作者很懒,什么也没有说
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| with_default_cmd | string | |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| ZM\ConsoleApplication | |
|
||||
77
docs/api/ZM/Container/BoundMethod.md
Normal file
77
docs/api/ZM/Container/BoundMethod.md
Normal file
@@ -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 | |
|
||||
882
docs/api/ZM/Container/Container.md
Normal file
882
docs/api/ZM/Container/Container.md
Normal file
@@ -0,0 +1,882 @@
|
||||
# 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<T> $abstract, array $parameters): Closure|mixed|T
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
获取一个绑定的实例
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| abstract | class-string<T> | 类或接口名 |
|
||||
| parameters | array | 参数 |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| Closure|mixed|T | 实例 |
|
||||
|
||||
|
||||
## getInstance
|
||||
|
||||
```php
|
||||
public function getInstance(): static
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
获取类实例
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| static | |
|
||||
|
||||
|
||||
## 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 | |
|
||||
|
||||
|
||||
## traitMake
|
||||
|
||||
```php
|
||||
public function traitMake(class-string<T> $abstract, array $parameters): Closure|mixed|T
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
获取一个绑定的实例
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| abstract | class-string<T> | 类或接口名 |
|
||||
| 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 |
|
||||
|
||||
|
||||
## 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 | |
|
||||
841
docs/api/ZM/Container/WorkerContainer.md
Normal file
841
docs/api/ZM/Container/WorkerContainer.md
Normal file
@@ -0,0 +1,841 @@
|
||||
# ZM\Container\WorkerContainer
|
||||
|
||||
## getInstance
|
||||
|
||||
```php
|
||||
public function getInstance(): static
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
获取类实例
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| static | |
|
||||
|
||||
|
||||
## 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<T> $abstract, array $parameters): Closure|mixed|T
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
获取一个绑定的实例
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| abstract | class-string<T> | 类或接口名 |
|
||||
| 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 | |
|
||||
217
docs/api/ZM/Context/Context.md
Normal file
217
docs/api/ZM/Context/Context.md
Normal file
@@ -0,0 +1,217 @@
|
||||
# ZM\Context\Context
|
||||
|
||||
## getServer
|
||||
|
||||
```php
|
||||
public function getServer(): Server
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
作者很懒,什么也没有说
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| Server | |
|
||||
|
||||
|
||||
## getData
|
||||
|
||||
```php
|
||||
public function getData(): mixed
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
作者很懒,什么也没有说
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| mixed | |
|
||||
|
||||
|
||||
## reply
|
||||
|
||||
```php
|
||||
public function reply(array|string $msg, bool|callable|Closure $yield): array|bool
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
only can used by cq->message event function
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| msg | array|string | 要回复的消息 |
|
||||
| yield | bool|callable|Closure | 是否协程挂起(true),是否绑定异步事件(Closure) |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| array|bool | 返回API调用结果 |
|
||||
|
||||
|
||||
## finalReply
|
||||
|
||||
```php
|
||||
public function finalReply(array|string $msg, bool $yield): mixed
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
作者很懒,什么也没有说
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| msg | array|string | 要回复的消息 |
|
||||
| yield | bool | 是否协程挂起(true),是否绑定异步事件(Closure) |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| mixed | |
|
||||
|
||||
|
||||
## waitMessage
|
||||
|
||||
```php
|
||||
public function waitMessage(string $prompt, int $timeout, string $timeout_prompt): string
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
作者很懒,什么也没有说
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| prompt | string | |
|
||||
| timeout | int | |
|
||||
| timeout_prompt | string | |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| string | 返回用户输入的内容 |
|
||||
|
||||
|
||||
## getArgs
|
||||
|
||||
```php
|
||||
public function getArgs(int|string $mode, string|Stringable $prompt_msg): float|int|string
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
根据选定的模式获取消息参数
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| mode | int|string | 获取的模式 |
|
||||
| prompt_msg | string|Stringable | 提示语回复 |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| float|int|string | |
|
||||
|
||||
|
||||
## getNextArg
|
||||
|
||||
```php
|
||||
public function getNextArg(string $prompt_msg): int|mixed|string
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
获取下一个参数
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| prompt_msg | string | 提示语回复 |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| int|mixed|string | 返回获取的参数 |
|
||||
|
||||
|
||||
## getFullArg
|
||||
|
||||
```php
|
||||
public function getFullArg(string $prompt_msg): int|mixed|string
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
获取接下来所有的消息当成一个完整的参数(包含空格)
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| prompt_msg | string | 提示语回复 |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| int|mixed|string | 返回获取的参数 |
|
||||
|
||||
|
||||
## getNumArg
|
||||
|
||||
```php
|
||||
public function getNumArg(string $prompt_msg): int|mixed|string
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
获取下一个数字类型的参数
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| prompt_msg | string | 提示语回复 |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| int|mixed|string | 返回获取的参数 |
|
||||
|
||||
|
||||
## cloneFromParent
|
||||
|
||||
```php
|
||||
public function cloneFromParent(): ContextInterface
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
作者很懒,什么也没有说
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| ContextInterface | 返回上下文 |
|
||||
117
docs/api/ZM/DB/DB.md
Normal file
117
docs/api/ZM/DB/DB.md
Normal file
@@ -0,0 +1,117 @@
|
||||
# ZM\DB\DB
|
||||
|
||||
## initTableList
|
||||
|
||||
```php
|
||||
public function initTableList(string $db_name): mixed
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
作者很懒,什么也没有说
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| db_name | string | 数据库名称 |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| mixed | |
|
||||
|
||||
|
||||
## table
|
||||
|
||||
```php
|
||||
public function table(string $table_name): Table
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
作者很懒,什么也没有说
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| table_name | string | 表名 |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| Table | 返回表对象 |
|
||||
|
||||
|
||||
## statement
|
||||
|
||||
```php
|
||||
public function statement(string $line): mixed
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
作者很懒,什么也没有说
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| line | string | SQL语句 |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| mixed | |
|
||||
|
||||
|
||||
## unprepared
|
||||
|
||||
```php
|
||||
public function unprepared(string $line): bool
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
作者很懒,什么也没有说
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| line | string | SQL语句 |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| bool | 返回查询是否成功的结果 |
|
||||
|
||||
|
||||
## rawQuery
|
||||
|
||||
```php
|
||||
public function rawQuery(string $line, array $params, int $fetch_mode): array|false
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
作者很懒,什么也没有说
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| line | string | SQL语句 |
|
||||
| params | array | 查询参数 |
|
||||
| fetch_mode | int | fetch规则 |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| array|false | 返回结果集或false |
|
||||
40
docs/api/ZM/DB/DeleteBody.md
Normal file
40
docs/api/ZM/DB/DeleteBody.md
Normal file
@@ -0,0 +1,40 @@
|
||||
# ZM\DB\DeleteBody
|
||||
|
||||
## __construct
|
||||
|
||||
```php
|
||||
public function __construct(ZM\DB\Table $table): mixed
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
DeleteBody constructor.
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| table | ZM\DB\Table | |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| mixed | |
|
||||
|
||||
|
||||
## save
|
||||
|
||||
```php
|
||||
public function save(): mixed
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
作者很懒,什么也没有说
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| mixed | |
|
||||
41
docs/api/ZM/DB/InsertBody.md
Normal file
41
docs/api/ZM/DB/InsertBody.md
Normal file
@@ -0,0 +1,41 @@
|
||||
# ZM\DB\InsertBody
|
||||
|
||||
## __construct
|
||||
|
||||
```php
|
||||
public function __construct(Table $table, array|string $row): mixed
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
InsertBody constructor.
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| table | Table | 表对象 |
|
||||
| row | array|string | 行数据 |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| mixed | |
|
||||
|
||||
|
||||
## save
|
||||
|
||||
```php
|
||||
public function save(): mixed
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
作者很懒,什么也没有说
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| mixed | |
|
||||
137
docs/api/ZM/DB/SelectBody.md
Normal file
137
docs/api/ZM/DB/SelectBody.md
Normal file
@@ -0,0 +1,137 @@
|
||||
# ZM\DB\SelectBody
|
||||
|
||||
## get
|
||||
|
||||
```php
|
||||
public function get(): mixed
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
作者很懒,什么也没有说
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| mixed | |
|
||||
|
||||
|
||||
## count
|
||||
|
||||
```php
|
||||
public function count(): int
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
作者很懒,什么也没有说
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| int | |
|
||||
|
||||
|
||||
## fetchAll
|
||||
|
||||
```php
|
||||
public function fetchAll(mixed $fetch_mode): mixed
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
作者很懒,什么也没有说
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| fetch_mode | mixed | |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| mixed | |
|
||||
|
||||
|
||||
## fetchFirst
|
||||
|
||||
```php
|
||||
public function fetchFirst(): null|mixed
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
作者很懒,什么也没有说
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| null|mixed | |
|
||||
|
||||
|
||||
## value
|
||||
|
||||
```php
|
||||
public function value(null|mixed $key): null|mixed
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
作者很懒,什么也没有说
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| key | null|mixed | |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| null|mixed | |
|
||||
|
||||
|
||||
## execute
|
||||
|
||||
```php
|
||||
public function execute(int $fetch_mode): mixed
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
作者很懒,什么也没有说
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| fetch_mode | int | |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| mixed | |
|
||||
|
||||
|
||||
## getSelectThing
|
||||
|
||||
```php
|
||||
public function getSelectThing(): mixed
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
作者很懒,什么也没有说
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| mixed | |
|
||||
17
docs/api/ZM/DB/Table.md
Normal file
17
docs/api/ZM/DB/Table.md
Normal file
@@ -0,0 +1,17 @@
|
||||
# ZM\DB\Table
|
||||
|
||||
## getTableName
|
||||
|
||||
```php
|
||||
public function getTableName(): mixed
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
作者很懒,什么也没有说
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| mixed | |
|
||||
41
docs/api/ZM/DB/UpdateBody.md
Normal file
41
docs/api/ZM/DB/UpdateBody.md
Normal file
@@ -0,0 +1,41 @@
|
||||
# ZM\DB\UpdateBody
|
||||
|
||||
## __construct
|
||||
|
||||
```php
|
||||
public function __construct(ZM\DB\Table $table, array $set_value): mixed
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
UpdateBody constructor.
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| table | ZM\DB\Table | |
|
||||
| set_value | array | |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| mixed | |
|
||||
|
||||
|
||||
## save
|
||||
|
||||
```php
|
||||
public function save(): mixed
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
作者很懒,什么也没有说
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| mixed | |
|
||||
1
docs/api/ZM/Entity/CQObject.md
Normal file
1
docs/api/ZM/Entity/CQObject.md
Normal file
@@ -0,0 +1 @@
|
||||
# ZM\Entity\CQObject
|
||||
1
docs/api/ZM/Entity/MatchResult.md
Normal file
1
docs/api/ZM/Entity/MatchResult.md
Normal file
@@ -0,0 +1 @@
|
||||
# ZM\Entity\MatchResult
|
||||
23
docs/api/ZM/Event/EventDispatcher.md
Normal file
23
docs/api/ZM/Event/EventDispatcher.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# ZM\Event\EventDispatcher
|
||||
|
||||
## interrupt
|
||||
|
||||
```php
|
||||
public function interrupt(mixed $return_var): mixed
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
作者很懒,什么也没有说
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| return_var | mixed | |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| mixed | |
|
||||
40
docs/api/ZM/Event/EventManager.md
Normal file
40
docs/api/ZM/Event/EventManager.md
Normal file
@@ -0,0 +1,40 @@
|
||||
# ZM\Event\EventManager
|
||||
|
||||
## loadEventByParser
|
||||
|
||||
```php
|
||||
public function loadEventByParser(ZM\Annotation\AnnotationParser $parser): mixed
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
作者很懒,什么也没有说
|
||||
|
||||
### 参数
|
||||
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -------- | ---- | ----------- |
|
||||
| parser | ZM\Annotation\AnnotationParser | |
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| mixed | |
|
||||
|
||||
|
||||
## registerTimerTick
|
||||
|
||||
```php
|
||||
public function registerTimerTick(): mixed
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
注册所有计时器给每个进程
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| mixed | |
|
||||
34
docs/api/ZM/Event/EventTracer.md
Normal file
34
docs/api/ZM/Event/EventTracer.md
Normal file
@@ -0,0 +1,34 @@
|
||||
# ZM\Event\EventTracer
|
||||
|
||||
## getCurrentEvent
|
||||
|
||||
```php
|
||||
public function getCurrentEvent(): null|AnnotationBase
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
获取当前注解事件的注解类,如CQCommand对象
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| null|AnnotationBase | |
|
||||
|
||||
|
||||
## getCurrentEventMiddlewares
|
||||
|
||||
```php
|
||||
public function getCurrentEventMiddlewares(): null|array|mixed
|
||||
```
|
||||
|
||||
### 描述
|
||||
|
||||
获取当前注解事件的中间件列表
|
||||
|
||||
### 返回
|
||||
|
||||
| 类型 | 描述 |
|
||||
| ---- | ----------- |
|
||||
| null|array|mixed | |
|
||||
1
docs/api/ZM/Event/SwooleEvent/OnBeforeReload.md
Normal file
1
docs/api/ZM/Event/SwooleEvent/OnBeforeReload.md
Normal file
@@ -0,0 +1 @@
|
||||
# ZM\Event\SwooleEvent\OnBeforeReload
|
||||
1
docs/api/ZM/Event/SwooleEvent/OnClose.md
Normal file
1
docs/api/ZM/Event/SwooleEvent/OnClose.md
Normal file
@@ -0,0 +1 @@
|
||||
# ZM\Event\SwooleEvent\OnClose
|
||||
1
docs/api/ZM/Event/SwooleEvent/OnManagerStart.md
Normal file
1
docs/api/ZM/Event/SwooleEvent/OnManagerStart.md
Normal file
@@ -0,0 +1 @@
|
||||
# ZM\Event\SwooleEvent\OnManagerStart
|
||||
1
docs/api/ZM/Event/SwooleEvent/OnManagerStop.md
Normal file
1
docs/api/ZM/Event/SwooleEvent/OnManagerStop.md
Normal file
@@ -0,0 +1 @@
|
||||
# ZM\Event\SwooleEvent\OnManagerStop
|
||||
24
docs/api/ZM/Event/SwooleEvent/OnMessage.md
Normal file
24
docs/api/ZM/Event/SwooleEvent/OnMessage.md
Normal file
@@ -0,0 +1,24 @@
|
||||
# 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 | |
|
||||
1
docs/api/ZM/Event/SwooleEvent/OnOpen.md
Normal file
1
docs/api/ZM/Event/SwooleEvent/OnOpen.md
Normal file
@@ -0,0 +1 @@
|
||||
# ZM\Event\SwooleEvent\OnOpen
|
||||
1
docs/api/ZM/Event/SwooleEvent/OnPipeMessage.md
Normal file
1
docs/api/ZM/Event/SwooleEvent/OnPipeMessage.md
Normal file
@@ -0,0 +1 @@
|
||||
# ZM\Event\SwooleEvent\OnPipeMessage
|
||||
1
docs/api/ZM/Event/SwooleEvent/OnRequest.md
Normal file
1
docs/api/ZM/Event/SwooleEvent/OnRequest.md
Normal file
@@ -0,0 +1 @@
|
||||
# ZM\Event\SwooleEvent\OnRequest
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user