Skip to content

Commit 9d48b1f

Browse files
committed
refactor: if conditions
1 parent b79a77d commit 9d48b1f

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

‎system/API/ResponseTrait.php‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -320,10 +320,11 @@ protected function format($data = null)
320320
$mime = "application/{$this->format}";
321321

322322
// Determine correct response type through content negotiation if not explicitly declared
323-
if (empty($this->format) || ! in_array($this->format, ['json', 'xml'], true)) {
324-
if ($this->request instanceof IncomingRequest) {
325-
$mime = $this->request->negotiate('media', $format->getConfig()->supportedResponseFormats, false);
326-
}
323+
if (
324+
(empty($this->format) || ! in_array($this->format, ['json', 'xml'], true))
325+
&& $this->request instanceof IncomingRequest
326+
) {
327+
$mime = $this->request->negotiate('media', $format->getConfig()->supportedResponseFormats, false);
327328
}
328329

329330
$this->response->setContentType($mime);

0 commit comments

Comments
 (0)