X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/0155525945bb030ae2265279dca8014c8cdcb2af..refs/pull/3039/head:/app/Api/ApiDocsGenerator.php diff --git a/app/Api/ApiDocsGenerator.php b/app/Api/ApiDocsGenerator.php index 0ed7e6712..d130304de 100644 --- a/app/Api/ApiDocsGenerator.php +++ b/app/Api/ApiDocsGenerator.php @@ -28,7 +28,7 @@ class ApiDocsGenerator if (Cache::has($cacheKey) && config('app.env') === 'production') { $docs = Cache::get($cacheKey); } else { - $docs = (new static())->generate(); + $docs = (new ApiDocsGenerator())->generate(); Cache::put($cacheKey, $docs, 60 * 24); } @@ -95,17 +95,14 @@ class ApiDocsGenerator } $rules = $class->getValdationRules()[$methodName] ?? []; - foreach ($rules as $param => $ruleString) { - $rules[$param] = explode('|', $ruleString); - } - return count($rules) > 0 ? $rules : null; + return empty($rules) ? null : $rules; } /** * Parse out the description text from a class method comment. */ - protected function parseDescriptionFromMethodComment(string $comment) + protected function parseDescriptionFromMethodComment(string $comment): string { $matches = []; preg_match_all('/^\s*?\*\s((?![@\s]).*?)$/m', $comment, $matches);