Skip to content

Commit 59c076f

Browse files
kenjissamsonasik
andcommitted
refactor: reverse if condition
Co-authored-by: Abdul Malik Ikhsan <samsonasik@gmail.com>
1 parent 585dbd0 commit 59c076f

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

system/CodeIgniter.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -316,12 +316,12 @@ public function run(?RouteCollectionInterface $routes = null, bool $returnRespon
316316
if ($this->request instanceof IncomingRequest && strtolower($this->request->getMethod()) === 'cli') {
317317
$this->response->setStatusCode(405)->setBody('Method Not Allowed');
318318

319-
if (! $this->returnResponse) {
320-
$this->sendResponse();
321-
} else {
319+
if ($this->returnResponse) {
322320
return $this->response;
323321
}
324322

323+
$this->sendResponse();
324+
325325
return;
326326
}
327327

@@ -357,12 +357,12 @@ public function run(?RouteCollectionInterface $routes = null, bool $returnRespon
357357
// the exception with the $to as the message
358358
$this->response->redirect(base_url($e->getMessage()), 'auto', $e->getCode());
359359

360-
if (! $this->returnResponse) {
361-
$this->sendResponse();
362-
} else {
360+
if ($this->returnResponse) {
363361
return $this->response;
364362
}
365363

364+
$this->sendResponse();
365+
366366
$this->callExit(EXIT_SUCCESS);
367367

368368
return;
@@ -959,12 +959,12 @@ protected function display404errors(PageNotFoundException $e)
959959

960960
$cacheConfig = new Cache();
961961
$this->gatherOutput($cacheConfig, $returned);
962-
if (! $this->returnResponse) {
963-
$this->sendResponse();
964-
} else {
962+
if ($this->returnResponse) {
965963
return $this->response;
966964
}
967965

966+
$this->sendResponse();
967+
968968
return;
969969
}
970970

0 commit comments

Comments
 (0)