Skip to content

Commit a6a8bae

Browse files
committed
Assign splat params and create ApiProblem
1 parent 3015627 commit a6a8bae

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/ApiProblem.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -226,18 +226,20 @@ public function response(...$params)
226226
{
227227
$apProblem = null;
228228

229-
print_r($params);die();
230-
231229
if ($this->getStatus()) {
232230
// Use current object
233231
$apProblem = $this;
234232
} else {
233+
$status = $params[2] ?? null;
234+
$detail = $params[1] ?? null;
235+
$type = $params[3] ?? null;
236+
$title = $params[4] ?? null;
237+
$additional = $params[5] ?? null;
238+
235239
// Called from a Facade, use local object
236-
$apiProblem = new ApiProblem();
240+
$apiProblem = new ApiProblem($status, $detail, $type, $title, $additional);
237241
}
238242

239-
$apiProblem = ($this->getStatus()) ? $this : new ApiProblem($status, $detail, $type, $title, $additional);
240-
241243
return response()
242244
->json($apiProblem->toArray(), $apiProblem->getStatus())
243245
->header('Content-Type', 'application/problem+json');

0 commit comments

Comments
 (0)