Skip to content
This repository was archived by the owner on Jun 11, 2020. It is now read-only.

Commit 0cbf51c

Browse files
committed
run code inspection check. fix some errors
1 parent cbda07c commit 0cbf51c

File tree

1 file changed

+16
-26
lines changed

1 file changed

+16
-26
lines changed

src/ArrayHelper.php

Lines changed: 16 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -311,19 +311,15 @@ public static function existsAll($need, $arr, $type = false)
311311
self::existsAll($v, $arr, $type);
312312
}
313313

314+
} elseif (\strpos($need, ',') !== false) {
315+
$need = \explode(',', $need);
316+
self::existsAll($need, $arr, $type);
314317
} else {
318+
$arr = self::valueToLower($arr);//小写
319+
$need = \strtolower(trim($need));//小写
315320

316-
#以逗号分隔的会被拆开,组成数组
317-
if (\strpos($need, ',') !== false) {
318-
$need = \explode(',', $need);
319-
self::existsAll($need, $arr, $type);
320-
} else {
321-
$arr = self::valueToLower($arr);//小写
322-
$need = \strtolower(trim($need));//小写
323-
324-
if (!\in_array($need, $arr, $type)) {
325-
return $need;
326-
}
321+
if (!\in_array($need, $arr, $type)) {
322+
return $need;
327323
}
328324
}
329325

@@ -898,17 +894,13 @@ public static function toString(
898894
if (\is_array($value)) {
899895
$string .= $keyStr . 'Array(' . self::toString($value, $length, $cycles, $showKey, $addMark, $separator,
900896
$string) . ')' . $separator;
897+
} elseif (\is_object($value)) {
898+
$string .= $keyStr . 'Object(' . \get_class($value) . ')' . $separator;
899+
} elseif (\is_resource($value)) {
900+
$string .= $keyStr . 'Resource(' . get_resource_type($value) . ')' . $separator;
901901
} else {
902-
if (\is_object($value)) {
903-
$string .= $keyStr . 'Object(' . \get_class($value) . ')' . $separator;
904-
} else {
905-
if (\is_resource($value)) {
906-
$string .= $keyStr . 'Resource(' . get_resource_type($value) . ')' . $separator;
907-
} else {
908-
$value = \strlen($value) > 150 ? substr($value, 0, 150) : $value;
909-
$string .= $mark . $keyStr . trim(htmlspecialchars($value)) . $mark . $separator;
910-
}
911-
}
902+
$value = \strlen($value) > 150 ? substr($value, 0, 150) : $value;
903+
$string .= $mark . $keyStr . trim(htmlspecialchars($value)) . $mark . $separator;
912904
}
913905
}
914906

@@ -963,12 +955,10 @@ public static function toLimitOut($array): array
963955

964956
if (\is_array($value) || \is_object($value)) {
965957
$value = \gettype($value) . '(...)';
958+
} elseif (\is_string($value) || is_numeric($value)) {
959+
$value = \strlen(trim($value));
966960
} else {
967-
if (\is_string($value) || is_numeric($value)) {
968-
$value = \strlen(trim($value));
969-
} else {
970-
$value = \gettype($value) . "($value)";
971-
}
961+
$value = \gettype($value) . "($value)";
972962
}
973963

974964
$array[$key] = $value;

0 commit comments

Comments
 (0)