From 8a1f362e9f64b54a725e1b4b1ba42d6eae3512b5 Mon Sep 17 00:00:00 2001 From: MaximAL Date: Fri, 5 Jun 2015 17:39:43 +0300 Subject: [PATCH 1/3] Remove redundant `else`s --- controllers/SiteController.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/controllers/SiteController.php b/controllers/SiteController.php index f959941..4ffba24 100644 --- a/controllers/SiteController.php +++ b/controllers/SiteController.php @@ -61,11 +61,10 @@ class SiteController extends Controller $model = new LoginForm(); if ($model->load(Yii::$app->request->post()) && $model->login()) { return $this->goBack(); - } else { - return $this->render('login', [ - 'model' => $model, - ]); } + return $this->render('login', [ + 'model' => $model, + ]); } public function actionLogout() @@ -82,11 +81,10 @@ class SiteController extends Controller Yii::$app->session->setFlash('contactFormSubmitted'); return $this->refresh(); - } else { - return $this->render('contact', [ - 'model' => $model, - ]); } + return $this->render('contact', [ + 'model' => $model, + ]); } public function actionAbout() From a52ca24ecd14aacb307a5dd011ff2dc6690e0371 Mon Sep 17 00:00:00 2001 From: MaximAL Date: Fri, 5 Jun 2015 17:40:49 +0300 Subject: [PATCH 2/3] Update LoginForm.php --- models/LoginForm.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/models/LoginForm.php b/models/LoginForm.php index 7bd44d4..227168c 100644 --- a/models/LoginForm.php +++ b/models/LoginForm.php @@ -58,9 +58,8 @@ class LoginForm extends Model { if ($this->validate()) { return Yii::$app->user->login($this->getUser(), $this->rememberMe ? 3600*24*30 : 0); - } else { - return false; } + return false; } /** From 0915b934abed59654094d399616f54a40e55ac1e Mon Sep 17 00:00:00 2001 From: MaximAL Date: Fri, 5 Jun 2015 17:41:11 +0300 Subject: [PATCH 3/3] Update ContactForm.php --- models/ContactForm.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/models/ContactForm.php b/models/ContactForm.php index d4052ee..361b80b 100644 --- a/models/ContactForm.php +++ b/models/ContactForm.php @@ -57,8 +57,7 @@ class ContactForm extends Model ->send(); return true; - } else { - return false; } + return false; } }