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 配置选项
*/
private array $config
= [
'skip_patterns' => ['/vendor/', '/tests/', '/cache/', '/node_modules/'],
'skip_directories' => [],
'extensions' => ['php'],
'max_depth' => 20,
'follow_links' => false,
'cache_enabled' => true,
'cache_ttl' => 3600,
'debug' => false,
];
private array $config = [
'skip_patterns' => ['/vendor/', '/tests/', '/cache/', '/node_modules/'],
'skip_directories' => [],
'extensions' => ['php'],
'max_depth' => 20,
'follow_links' => false,
'cache_enabled' => true,
'cache_ttl' => 3600,
'debug' => false,
];
/**
* 设置扫描器配置
@@ -178,7 +177,7 @@ class Scanner extends Component
} catch (Throwable $e) {
$this->logError($e, [
'file' => $path,
'action' => 'process_file'
'action' => 'process_file',
]);
// 如果是语法错误,可以选择抛出或记录
@@ -246,7 +245,7 @@ class Scanner extends Component
if ($this->config['debug']) {
$this->logError($e, [
'file' => $path,
'action' => 'opcache_optimize'
'action' => 'opcache_optimize',
]);
}
}
@@ -329,7 +328,7 @@ class Scanner extends Component
} catch (Throwable $e) {
$this->logError($e, [
'class' => $class,
'action' => 'analyze_class'
'action' => 'analyze_class',
]);
}
}
@@ -386,7 +385,7 @@ class Scanner extends Component
'class' => $class,
'method' => $method->getName(),
'attribute' => $attributeName,
'action' => 'process_attribute'
'action' => 'process_attribute',
]);
}
}
@@ -468,7 +467,7 @@ class Scanner extends Component
'files' => $this->files,
'mtimes' => $this->fileMtimes,
'timestamp' => time(),
'version' => '1.0'
'version' => '1.0',
];
file_put_contents($cacheFile, json_encode($data, JSON_PRETTY_PRINT));