This repository has been archived by the owner on Dec 14, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
299 additions
and
261 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
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 |
---|---|---|
@@ -1,13 +1,22 @@ | ||
<?php | ||
|
||
/** | ||
* 框架基类,用来做各种初始化和自动加载 | ||
* | ||
* @author carolkey <[email protected]> | ||
* @since 2.0 | ||
* @link https://carolkey.github.io/ | ||
* @license MIT | ||
*/ | ||
class Lying | ||
{ | ||
/** | ||
* @var array 类文件映射 | ||
* @var array 核心类文件映射 | ||
*/ | ||
private static $classMap = []; | ||
|
||
/** | ||
* @var array 命名空间映射 | ||
* @var array 加载方式配置 | ||
*/ | ||
private static $extend = []; | ||
|
||
|
@@ -29,7 +38,7 @@ public static function boot() | |
|
||
self::$maker = new \lying\service\Maker(require DIR_CONF . '/service.php'); | ||
|
||
self::$extend = self::$maker->createService('config')->read('loader'); | ||
self::$extend = self::$maker->config()->read('loader'); | ||
} | ||
|
||
/** | ||
|
@@ -53,7 +62,7 @@ private static function autoload($className) | |
/** | ||
* classMap加载 | ||
* @param string $className 类名 | ||
* @return string|boolean 成功返回文件绝对路径,失败返回false | ||
* @return string|boolean 成功返回文件绝对路径,失败返回false | ||
*/ | ||
private static function classMapLoader($className) | ||
{ | ||
|
@@ -64,9 +73,9 @@ private static function classMapLoader($className) | |
} | ||
|
||
/** | ||
* PSR-4自动加载,参考 http://www.php-fig.org/psr/psr-4/ | ||
* PSR-4自动加载,参考 http://www.php-fig.org/psr/psr-4/ | ||
* @param string $className 类名 | ||
* @return string|boolean 成功返回文件绝对路径,失败返回false | ||
* @return string|boolean 成功返回文件绝对路径,失败返回false | ||
*/ | ||
private static function psr4Loader($className) | ||
{ | ||
|
@@ -96,9 +105,9 @@ private static function psr4Loader($className) | |
} | ||
|
||
/** | ||
* PSR-0自动加载,参考 http://www.php-fig.org/psr/psr-0/ | ||
* PSR-0自动加载,参考 http://www.php-fig.org/psr/psr-0/ | ||
* @param string $className 类名 | ||
* @return string|boolean 成功返回文件绝对路径,失败返回false | ||
* @return string|boolean 成功返回文件绝对路径,失败返回false | ||
*/ | ||
private static function psr0Loader($className) | ||
{ | ||
|
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
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
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 |
---|---|---|
@@ -1,6 +1,14 @@ | ||
<?php | ||
namespace lying\service; | ||
|
||
/** | ||
* 配置读取组件 | ||
* | ||
* @author carolkey <[email protected]> | ||
* @since 2.0 | ||
* @link https://carolkey.github.io/ | ||
* @license MIT | ||
*/ | ||
class Config | ||
{ | ||
/** | ||
|
@@ -10,9 +18,9 @@ class Config | |
|
||
/** | ||
* 返回某个配置的内容 | ||
* @param string $name 配置文件名,如果文件不存在,抛出异常 | ||
* @param string $key 要获取的键,如果键不存在,抛出异常 | ||
* @return mixed 返回配置数组或者某个键值 | ||
* @param string $name 配置文件名,如果文件不存在,抛出异常 | ||
* @param string $key 要获取的键,如果键不存在,抛出异常 | ||
* @return mixed 返回配置数组或者某个键的值 | ||
* @throws \Exception 当配置文件不存在或者配置键不存在抛出异常 | ||
*/ | ||
public function read($name, $key = null) | ||
|
@@ -26,9 +34,9 @@ public function read($name, $key = null) | |
} | ||
|
||
/** | ||
* 设置某个配置,配置的改变并不会改变配置文件,只会改变运行时的配置 | ||
* 设置某个配置,配置的改变并不会改变配置文件,只会改变运行时的配置 | ||
* @param string $name 配置文件名或者临时配置键名 | ||
* @param string $params 参数数组,默认为空 | ||
* @param array $params 配置数组,默认为空数组 | ||
*/ | ||
public function write($name, $params = []) | ||
{ | ||
|
Oops, something went wrong.