-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #225 from zhamao-robot/refactor-config-config
重构配置类配置
- Loading branch information
Showing
7 changed files
with
81 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,3 +82,6 @@ package-lock.json | |
/.tool-version | ||
|
||
.DS_Store | ||
|
||
### PHP CS Fixer ### | ||
.php-cs-fixer.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* Config 配置类的配置文件 | ||
* 由于 Config 类是第一批被加载的类,因此本文件存在以下限制: | ||
* 1. 只能使用 PHP 格式 | ||
* 2. 无法利用容器及依赖注入 | ||
* 3. 必须存在于本地,无法使用远程配置(后续版本可能会支持) | ||
*/ | ||
return [ | ||
'repository' => [ | ||
\OneBot\Config\Repository::class, // 配置仓库,须实现 \OneBot\Config\RepositoryInterface 接口 | ||
[], // 传入的参数,依序传入构造函数 | ||
], | ||
'loader' => [ | ||
\OneBot\Config\Loader\DelegateLoader::class, // 配置加载器,须实现 \OneBot\Config\LoaderInterface 接口 | ||
[], // 传入的参数,依序传入构造函数 | ||
], | ||
'source' => [ | ||
'extensions' => ['php', 'yaml', 'yml', 'json', 'toml'], // 配置文件扩展名 | ||
'paths' => [ | ||
SOURCE_ROOT_DIR . '/config', // 配置文件所在目录 | ||
// 可以添加多个配置文件目录 | ||
], | ||
], | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters