From 75be7c242c5f8c90cbb139b34826277e0ac928a7 Mon Sep 17 00:00:00 2001 From: Chaim Date: Sat, 18 Apr 2020 12:08:06 +0800 Subject: [PATCH] - update facade --- composer.json | 3 - git.sh | 2 + src/Service.php | 76 -------------------------- src/facade/{Date.php => Dates.php} | 9 +-- src/facade/Files.php | 13 +++-- src/facade/Ints.php | 11 ++-- src/facade/Preg.php | 53 ------------------ src/facade/Pregs.php | 54 ++++++++++++++++++ src/facade/{Random.php => Randoms.php} | 13 +++-- src/facade/{Str.php => Strings.php} | 19 ++++--- src/facade/{Time.php => Times.php} | 27 ++++----- src/facade/{UnIqId.php => UnIqIds.php} | 15 ++--- src/facade/Urls.php | 11 ++-- src/facade/Xmls.php | 11 ++-- src/{Date.php => helper/Dates.php} | 10 ++-- src/{ => helper}/Files.php | 4 +- src/{ => helper}/Ints.php | 8 +-- src/{Preg.php => helper/Pregs.php} | 10 ++-- src/{Random.php => helper/Randoms.php} | 10 ++-- src/{Str.php => helper/Strings.php} | 20 +++---- src/{Time.php => helper/Times.php} | 10 ++-- src/{UnIqId.php => helper/UnIqIds.php} | 10 ++-- src/{ => helper}/Urls.php | 10 ++-- src/{ => helper}/Xmls.php | 8 +-- src/service/TestService.php | 32 ----------- tests/test.php | 9 ++- 26 files changed, 181 insertions(+), 277 deletions(-) create mode 100644 git.sh delete mode 100644 src/Service.php rename src/facade/{Date.php => Dates.php} (90%) delete mode 100644 src/facade/Preg.php create mode 100644 src/facade/Pregs.php rename src/facade/{Random.php => Randoms.php} (79%) rename src/facade/{Str.php => Strings.php} (65%) rename src/facade/{Time.php => Times.php} (52%) rename src/facade/{UnIqId.php => UnIqIds.php} (73%) rename src/{Date.php => helper/Dates.php} (88%) rename src/{ => helper}/Files.php (97%) rename src/{ => helper}/Ints.php (89%) rename src/{Preg.php => helper/Pregs.php} (97%) rename src/{Random.php => helper/Randoms.php} (96%) rename src/{Str.php => helper/Strings.php} (93%) rename src/{Time.php => helper/Times.php} (96%) rename src/{UnIqId.php => helper/UnIqIds.php} (95%) rename src/{ => helper}/Urls.php (89%) rename src/{ => helper}/Xmls.php (93%) delete mode 100644 src/service/TestService.php diff --git a/composer.json b/composer.json index b6781d7..6951130 100644 --- a/composer.json +++ b/composer.json @@ -39,9 +39,6 @@ }, "extra": { "think": { - "services": [ - "DtApp\\ThinkLibrary" - ], "config": { "dtapp": "src/config.php" } diff --git a/git.sh b/git.sh new file mode 100644 index 0000000..ff2d5a8 --- /dev/null +++ b/git.sh @@ -0,0 +1,2 @@ +git push gitee +git push github diff --git a/src/Service.php b/src/Service.php deleted file mode 100644 index 7a9f562..0000000 --- a/src/Service.php +++ /dev/null @@ -1,76 +0,0 @@ -app = $app; - $this->initialize(); - } - - /** - * 初始化服务 - * @return $this - */ - protected function initialize() - { - return $this; - } - - /** - * 静态实例对象 - * @param array $args - * @return static - */ - public static function instance(...$args) - { - return Container::getInstance()->make(static::class, $args); - } -} diff --git a/src/facade/Date.php b/src/facade/Dates.php similarity index 90% rename from src/facade/Date.php rename to src/facade/Dates.php index 92a05c6..6e8bca6 100644 --- a/src/facade/Date.php +++ b/src/facade/Dates.php @@ -16,16 +16,17 @@ namespace DtApp\ThinkLibrary\facade; +use DtApp\ThinkLibrary\helper\Dates as helper; use think\Facade; /** * 日期门面 - * Class Date + * Class Dates * @see \DtApp\ThinkLibrary\Date * @package think\facade - * @mixin \DtApp\ThinkLibrary\Date + * @mixin helper */ -class Date extends Facade +class Dates extends Facade { /** * 获取当前Facade对应类名(或者已经绑定的容器对象标识) @@ -34,6 +35,6 @@ class Date extends Facade */ protected static function getFacadeClass() { - return 'DtApp\ThinkLibrary\Date'; + return helper::class; } } diff --git a/src/facade/Files.php b/src/facade/Files.php index 944b104..c28efbe 100644 --- a/src/facade/Files.php +++ b/src/facade/Files.php @@ -16,18 +16,19 @@ namespace DtApp\ThinkLibrary\facade; +use DtApp\ThinkLibrary\helper\Files as helper; use think\Facade; /** * 文件门面 * Class Files - * @see \DtApp\ThinkLibrary\Files + * @see \DtApp\ThinkLibrary\helper\Files * @package think\facade - * @mixin \DtApp\ThinkLibrary\Files + * @mixin helper * - * @method \DtApp\ThinkLibrary\Files delete(string $name) bool 删除文件 - * @method \DtApp\ThinkLibrary\Files deletes(string $name) bool 删除文件夹 - * @method \DtApp\ThinkLibrary\Files folderZip(string $name, string $suffix_name = '.png', string $file_name = '*') bool 把文件夹里面的文件打包成zip文件 + * @method helper delete(string $name) bool 删除文件 + * @method helper deletes(string $name) bool 删除文件夹 + * @method helper folderZip(string $name, string $suffix_name = '.png', string $file_name = '*') bool 把文件夹里面的文件打包成zip文件 */ class Files extends Facade { @@ -38,6 +39,6 @@ class Files extends Facade */ protected static function getFacadeClass() { - return 'DtApp\ThinkLibrary\Files'; + return helper::class; } } diff --git a/src/facade/Ints.php b/src/facade/Ints.php index 31059b2..c949e2b 100644 --- a/src/facade/Ints.php +++ b/src/facade/Ints.php @@ -16,17 +16,18 @@ namespace DtApp\ThinkLibrary\facade; +use DtApp\ThinkLibrary\helper\Ints as helper; use think\Facade; /** * 数字门面 * Class Ints - * @see \DtApp\ThinkLibrary\Ints + * @see \DtApp\ThinkLibrary\helper\Ints * @package think\facade - * @mixin \DtApp\ThinkLibrary\Ints + * @mixin helper * - * @method \DtApp\ThinkLibrary\Ints isEvenNumbers(int $num) bool 判断一个数是不是偶数 - * @method \DtApp\ThinkLibrary\Ints isOddNumbers(int $num) bool 判断一个数是不是奇数 + * @method helper isEvenNumbers(int $num) bool 判断一个数是不是偶数 + * @method helper isOddNumbers(int $num) bool 判断一个数是不是奇数 */ class Ints extends Facade { @@ -37,7 +38,7 @@ class Ints extends Facade */ protected static function getFacadeClass() { - return 'DtApp\ThinkLibrary\Ints'; + return helper::class; } } diff --git a/src/facade/Preg.php b/src/facade/Preg.php deleted file mode 100644 index 2dfc85a..0000000 --- a/src/facade/Preg.php +++ /dev/null @@ -1,53 +0,0 @@ - $v) if ($k != "sign" && $v !== "" && !is_array($v)) $buff .= $k . "=" . $v . "&"; diff --git a/src/Xmls.php b/src/helper/Xmls.php similarity index 93% rename from src/Xmls.php rename to src/helper/Xmls.php index 51e99b5..e68ef7d 100644 --- a/src/Xmls.php +++ b/src/helper/Xmls.php @@ -14,7 +14,7 @@ // | Packagist 地址 :https://packagist.org/packages/liguangchun/think-library // +---------------------------------------------------------------------- -namespace DtApp\ThinkLibrary; +namespace DtApp\ThinkLibrary\helper; use DtApp\ThinkLibrary\exception\DtAppException; @@ -22,7 +22,7 @@ use DtApp\ThinkLibrary\exception\DtAppException; * XML管理类 * Class Xmls * @mixin Xmls - * @package DtApp\ThinkLibrary + * @package DtApp\ThinkLibrary\helper */ class Xmls { @@ -32,7 +32,7 @@ class Xmls * @return string * @throws DtAppException */ - public function toXml(array $values) + public function toXml($values) { if (!is_array($values) || count($values) <= 0) throw new DtAppException('数组数据异常!'); $xml = ""; @@ -55,7 +55,7 @@ class Xmls * @return mixed * @throws DtAppException */ - public function toArray(string $xml) + public function toArray($xml) { if (!$xml) throw new DtAppException('xml数据异常!'); libxml_disable_entity_loader(true); diff --git a/src/service/TestService.php b/src/service/TestService.php deleted file mode 100644 index 619e23f..0000000 --- a/src/service/TestService.php +++ /dev/null @@ -1,32 +0,0 @@ -index()); +//var_dump(TestService::instance()->index()); + +var_dump(Times::getTime());