From c8803728728fa71a47516368876bfdfdaa41232a Mon Sep 17 00:00:00 2001 From: dogstar Date: Mon, 5 Mar 2018 19:44:12 +0800 Subject: [PATCH] comments modified --- src/Request/Formatter/StringFormatter.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/Request/Formatter/StringFormatter.php b/src/Request/Formatter/StringFormatter.php index 432c901..91c3bfa 100644 --- a/src/Request/Formatter/StringFormatter.php +++ b/src/Request/Formatter/StringFormatter.php @@ -18,12 +18,11 @@ class StringFormatter extends BaseFormatter implements Formatter { * 对字符串进行格式化 * * @param mixed $value 变量值 - * @@param array $rule array('len' => ‘最长长度’) + * @param array $rule array('len' => ‘最长长度’) * * @return string 格式化后的变量 */ public function parse($value, $rule) { - $rs = strval($this->filterByStrLen(strval($value), $rule)); $this->filterByRegex($rs, $rule); @@ -35,7 +34,6 @@ public function parse($value, $rule) { * 根据字符串长度进行截取 */ protected function filterByStrLen($value, $rule) { - $lenRule = $rule; $lenRule['name'] = $lenRule['name'] . '.len'; $lenValue = !empty($lenRule['format']) ? mb_strlen($value, $lenRule['format']) : strlen($value); @@ -47,7 +45,6 @@ protected function filterByStrLen($value, $rule) { * 进行正则匹配 */ protected function filterByRegex($value, $rule) { - if (!isset($rule['regex']) || empty($rule['regex'])) { return; }