From dfc87000c08fb9c9846e3525f85da9aa5c67fcdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Tue, 18 Apr 2023 10:44:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Scanner.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Scanner.php b/Scanner.php index 8e83a98..982090b 100644 --- a/Scanner.php +++ b/Scanner.php @@ -7,6 +7,7 @@ namespace Kiri\Di; use Exception; use Kiri\Abstracts\Component; +use Kiri\Abstracts\Config; use ReflectionException; class Scanner extends Component @@ -69,11 +70,15 @@ class Scanner extends Component private function load_dir(string $path): void { $dir = new \DirectoryIterator($path); + $skip = Config::get('scanner.skip', []); foreach ($dir as $value) { if ($value->isDot() || str_starts_with($value->getFilename(), '.')) { continue; } if ($value->isDir()) { + if (in_array($value->getRealPath() . '/', $skip)) { + continue; + } $this->load_dir($value->getRealPath()); } else if ($value->getExtension() == 'php') { $this->load_file($value->getRealPath());