From 12604544d59aa640aa08ca33fe26e52dede423fc Mon Sep 17 00:00:00 2001 From: wb-hx510875 Date: Tue, 9 Jun 2020 15:41:01 +0800 Subject: [PATCH] reduce dependency --- composer.json | 3 --- src/Helper.php | 7 +++---- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/composer.json b/composer.json index 7bd2e55..f85f140 100644 --- a/composer.json +++ b/composer.json @@ -36,10 +36,7 @@ "ext-simplexml": "*", "ext-xmlwriter": "*", "guzzlehttp/guzzle": "^6.3", - "danielstjules/stringy": "^3.1", - "mtdowling/jmespath.php": "^2.4", "adbario/php-dot-notation": "^2.2", - "clagiordano/weblibs-configmanager": "^1.0", "alibabacloud/tea": "^3.0" }, "require-dev": { diff --git a/src/Helper.php b/src/Helper.php index 45438cf..6d9eab4 100644 --- a/src/Helper.php +++ b/src/Helper.php @@ -3,7 +3,6 @@ namespace AlibabaCloud\Credentials; use Closure; -use Stringy\Stringy; /** * Class Helper @@ -67,7 +66,7 @@ public static function inOpenBasedir($filename) public static function inDir($filename, array $dirs) { foreach ($dirs as $dir) { - if (!Stringy::create($dir)->endsWith(DIRECTORY_SEPARATOR)) { + if ($dir[strlen($dir) - 1] !== DIRECTORY_SEPARATOR) { $dir .= DIRECTORY_SEPARATOR; } @@ -145,8 +144,8 @@ public static function value($value) public static function envSubstr($value) { return ($valueLength = strlen($value)) > 1 - && strpos($value, '"') === 0 - && $value[$valueLength - 1] === '"'; + && strpos($value, '"') === 0 + && $value[$valueLength - 1] === '"'; } /**