From 1b78f1bd289484906034ef5499c7ecd4cf05f749 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=AF=E7=AB=8B?= Date: Tue, 10 Sep 2024 09:24:08 +0800 Subject: [PATCH] Update ToolsExtend.php --- plugin/think-library/src/extend/ToolsExtend.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugin/think-library/src/extend/ToolsExtend.php b/plugin/think-library/src/extend/ToolsExtend.php index 9941383bd..4f7f548d1 100644 --- a/plugin/think-library/src/extend/ToolsExtend.php +++ b/plugin/think-library/src/extend/ToolsExtend.php @@ -101,20 +101,20 @@ class ToolsExtend * @param string $path 要扫描的目录路径 * @param ?Closure $filterFile 用于过滤文件的闭包 * @param ?Closure $filterPath 用于过滤目录的闭包 - * @param boolean $shortPath 是否返回相对于给定路径的短路径 + * @param boolean $short 是否返回相对于给定路径的短路径 * @param ?integer $depth 当前递归深度,null 表示无限制深度 * @return array 包含文件路径的数组 */ - public static function findFilesArray(string $path, ?Closure $filterFile = null, ?Closure $filterPath = null, bool $shortPath = true, ?int $depth = null): array + public static function findFilesArray(string $path, ?Closure $filterFile = null, ?Closure $filterPath = null, bool $short = true, ?int $depth = null): array { $files = []; if (is_file($path)) { if (($file = new SplFileInfo($path)) && ($filterFile === null || $filterFile($file))) { - $files[] = $shortPath ? $file->getBasename() : $file->getPathname(); + $files[] = $short ? $file->getBasename() : $file->getPathname(); } } elseif (is_dir($path)) { foreach (static::findFilesYield($path, $filterFile, $filterPath, $depth) as $file) { - $files[] = $shortPath ? substr($file->getRealPath(), strlen($path) + 1) : $file->getRealPath(); + $files[] = $short ? substr($file->getRealPath(), strlen($path) + 1) : $file->getRealPath(); } } return $files;