chenlong 1 year ago
parent
commit
f527ac08dd
  1. 18
      Service/ApiDocService.php

18
Service/ApiDocService.php

@ -25,13 +25,15 @@ class ApiDocService
{ {
use AopProxyTrait; use AopProxyTrait;
private array $config = [];
/** /**
* @throws \Exception * @throws \Exception
*/ */
public function get(): array public function get(): array
{ {
$appName = Hy::config('app_name', ''); $appName = Hy::config('app_name', '');
$getPath = Hy::config('plugins.ApiDoc.get_path', []); $getPath = $this->getDefaultConfig('get_path');
$apiLists = $this->scan($getPath); $apiLists = $this->scan($getPath);
@ -43,6 +45,20 @@ class ApiDocService
]; ];
} }
/**
* @param string|null $key
*
* @return array|mixed
*/
private function getDefaultConfig(string $key = null): mixed
{
if (!$this->config) {
$this->config = Hy::config('plugins.ApiDoc') ?: include __DIR__ . '/../config.php';
}
return $key === null ? $this->config : $this->config[$key];
}
/** /**
* @param array $paths * @param array $paths
* *

Loading…
Cancel
Save