[go: nahoru, domu]

Skip to content

Commit

Permalink
fix: remove elseChain method using
Browse files Browse the repository at this point in the history
Refs: #18
  • Loading branch information
DenTray committed May 2, 2022
1 parent 97564f8 commit 43ebb46
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions src/Services/SwaggerService.php
Original file line number Diff line number Diff line change
Expand Up @@ -554,22 +554,23 @@ protected function parseRequestName($request)

protected function getResponseDescription($code)
{
$defaultDescription = Response::$statusTexts[$code];

$request = $this->getConcreteRequest();

return elseChain(
function () use ($request, $code) {
return empty($request) ? Response::$statusTexts[$code] : null;
},
function () use ($request, $code) {
return $this->annotationReader->getClassAnnotations($request)->get("_{$code}");
},
function () use ($code) {
return config("auto-doc.defaults.code-descriptions.{$code}");
},
function () use ($code) {
return Response::$statusTexts[$code];
}
);
if (empty($request)) {
return $defaultDescription;
}

$annotations = $this->getClassAnnotations($request);

$localDescription = Arr::get($annotations, "_{$code}");

if (!empty($localDescription)) {
return $localDescription;
}

return config("auto-doc.defaults.code-descriptions.{$code}", $defaultDescription);
}

protected function getActionName($uri)
Expand Down

0 comments on commit 43ebb46

Please sign in to comment.