This commit is contained in:
2025-12-31 01:07:57 +08:00
parent 93fc09342a
commit 0110f1947a
+15 -16
View File
@@ -36,17 +36,16 @@ class Scanner extends Component
/** /**
* @var array 配置选项 * @var array 配置选项
*/ */
private array $config private array $config = [
= [ 'skip_patterns' => ['/vendor/', '/tests/', '/cache/', '/node_modules/'],
'skip_patterns' => ['/vendor/', '/tests/', '/cache/', '/node_modules/'], 'skip_directories' => [],
'skip_directories' => [], 'extensions' => ['php'],
'extensions' => ['php'], 'max_depth' => 20,
'max_depth' => 20, 'follow_links' => false,
'follow_links' => false, 'cache_enabled' => true,
'cache_enabled' => true, 'cache_ttl' => 3600,
'cache_ttl' => 3600, 'debug' => false,
'debug' => false, ];
];
/** /**
* 设置扫描器配置 * 设置扫描器配置
@@ -178,7 +177,7 @@ class Scanner extends Component
} catch (Throwable $e) { } catch (Throwable $e) {
$this->logError($e, [ $this->logError($e, [
'file' => $path, 'file' => $path,
'action' => 'process_file' 'action' => 'process_file',
]); ]);
// 如果是语法错误,可以选择抛出或记录 // 如果是语法错误,可以选择抛出或记录
@@ -246,7 +245,7 @@ class Scanner extends Component
if ($this->config['debug']) { if ($this->config['debug']) {
$this->logError($e, [ $this->logError($e, [
'file' => $path, 'file' => $path,
'action' => 'opcache_optimize' 'action' => 'opcache_optimize',
]); ]);
} }
} }
@@ -329,7 +328,7 @@ class Scanner extends Component
} catch (Throwable $e) { } catch (Throwable $e) {
$this->logError($e, [ $this->logError($e, [
'class' => $class, 'class' => $class,
'action' => 'analyze_class' 'action' => 'analyze_class',
]); ]);
} }
} }
@@ -386,7 +385,7 @@ class Scanner extends Component
'class' => $class, 'class' => $class,
'method' => $method->getName(), 'method' => $method->getName(),
'attribute' => $attributeName, 'attribute' => $attributeName,
'action' => 'process_attribute' 'action' => 'process_attribute',
]); ]);
} }
} }
@@ -468,7 +467,7 @@ class Scanner extends Component
'files' => $this->files, 'files' => $this->files,
'mtimes' => $this->fileMtimes, 'mtimes' => $this->fileMtimes,
'timestamp' => time(), 'timestamp' => time(),
'version' => '1.0' 'version' => '1.0',
]; ];
file_put_contents($cacheFile, json_encode($data, JSON_PRETTY_PRINT)); file_put_contents($cacheFile, json_encode($data, JSON_PRETTY_PRINT));