Use explicit exit statement instead of return

This commit is contained in:
Giuseppe Criscione 2018-10-12 23:21:59 +02:00
parent 31217514f6
commit 61923a7912
6 changed files with 8 additions and 5 deletions

View File

@ -80,7 +80,7 @@ class Admin
}
if ($this->users->isEmpty()) {
return $this->registerAdmin();
$this->registerAdmin();
}
if (!$this->isLoggedIn() && HTTPRequest::uri() !== '/login/') {
@ -139,6 +139,7 @@ class Admin
}
$controller = new Controllers\Register();
$controller->register();
exit;
}
protected function loadRoutes()

View File

@ -22,7 +22,6 @@ class Authentication extends AbstractController
if ($limiter->hasReachedLimit()) {
$minutes = round($this->option('admin.login_reset_time') / 60);
$this->error($this->label('login.attempt.too-many', $minutes));
return;
}
switch (HTTPRequest::method()) {
@ -47,7 +46,7 @@ class Authentication extends AbstractController
$data = new DataGetter(HTTPRequest::postData());
if (!$data->has(array('username', 'password'))) {
return $this->error();
$this->error();
}
$limiter->registerAttempt();
@ -98,5 +97,6 @@ class Authentication extends AbstractController
$defaults = array('title' => $this->label('login.login'));
$this->notify($message, 'error');
$this->view('authentication.login', array_merge($defaults, $data));
exit;
}
}

View File

@ -43,5 +43,6 @@ class Errors extends AbstractController
'description' => $this->label('errors.error.' . $name . '.description'),
'action' => $action
));
exit;
}
}

View File

@ -197,7 +197,7 @@ class Pages extends AbstractController
$from = max(0, $data->get('from'));
$to = max(0, $data->get('to'));
if ($to === $from) {
return;
exit;
}
array_splice($pages, $to, 0, array_splice($pages, $from, 1));

View File

@ -21,6 +21,7 @@ class Errors
Header::status($status);
$message = Header::$statuses[$status];
require FORMWORK_PATH . 'error.php';
exit;
}
public static function exceptionHandler($exception)

View File

@ -102,7 +102,7 @@ class Formwork
{
if ($this->option('cache.enabled') && $data = $this->cache->fetch($this->cacheKey)) {
echo $data;
return;
exit;
}
$this->router->add(array(