chenlong-sd 1 year ago
parent
commit
ab29797056
  1. 11
      Service/ApiDocService.php

11
Service/ApiDocService.php

@ -71,12 +71,15 @@ class ApiDocService
foreach ($paths as ['path' => $path, 'namespace' => $namespace]) {
Tool::dir($path)->each(function (Tool\Dir\EachFile $eachFile) use ($namespace, &$apiList){
$classname = strtr(basename($eachFile->filename), ['.php' => '']);
if (!str_ends_with($eachFile->filename, '.php') || !preg_match('/^[a-zA-Z1-9]+$/', $classname)){
return;
}
$classFullName = implode("\\", [$namespace, ...$eachFile->relativelyDirs, $classname]);
try {
$class = \Hyperf\Support\make($classFullName);
if (!$class) return;
$reflectionClass = $this->apiClassCheck($class);
if (!class_exists($classFullName)) {
return;
}
$reflectionClass = $this->apiClassCheck($classFullName);
if ($reflectionClass) {
$apiList[] = $this->apiResolve($reflectionClass);
}

Loading…
Cancel
Save