Skip to content

Commit

Permalink
refactor: reverse if condition
Browse files Browse the repository at this point in the history
Co-authored-by: Abdul Malik Ikhsan <samsonasik@gmail.com>
  • Loading branch information
kenjis and samsonasik authored Oct 23, 2022
1 parent 585dbd0 commit 54b9d3a
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions system/CodeIgniter.php
Original file line number Diff line number Diff line change
Expand Up @@ -316,12 +316,11 @@ public function run(?RouteCollectionInterface $routes = null, bool $returnRespon
if ($this->request instanceof IncomingRequest && strtolower($this->request->getMethod()) === 'cli') {
$this->response->setStatusCode(405)->setBody('Method Not Allowed');

if (! $this->returnResponse) {
$this->sendResponse();
} else {
if ($this->returnResponse) {
return $this->response;
}

$this->sendResponse();
return;
}

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

if (! $this->returnResponse) {
$this->sendResponse();
} else {
if ($this->returnRespose) {
return $this->response;
}

$this->sendResponse();

$this->callExit(EXIT_SUCCESS);

return;
Expand Down Expand Up @@ -959,12 +958,11 @@ protected function display404errors(PageNotFoundException $e)

$cacheConfig = new Cache();
$this->gatherOutput($cacheConfig, $returned);
if (! $this->returnResponse) {
$this->sendResponse();
} else {
if ($this->returnResponse) {
return $this->response;
}

$this->sendResponse();
return;
}

Expand Down

0 comments on commit 54b9d3a

Please sign in to comment.