From f034658f5caeb5fd875120f001b2ce85c8f87a55 Mon Sep 17 00:00:00 2001 From: James Droste Date: Wed, 19 Apr 2017 15:42:34 -0400 Subject: [PATCH] Fixing some Code Sniffing --- app/Controller/AppController.php | 3 ++- app/Controller/Component/AuthComponent.php | 12 ++++++++---- app/Controller/PagesController.php | 3 ++- app/Controller/UserController.php | 3 ++- app/Lib/InjectAbstraction.php | 17 ++++++++++------- app/Plugin/BankWeb/Config/Schema/schema.php | 3 ++- app/View/Helper/MiscHelper.php | 3 ++- 7 files changed, 28 insertions(+), 16 deletions(-) diff --git a/app/Controller/AppController.php b/app/Controller/AppController.php index fe3af9a..852ac1f 100644 --- a/app/Controller/AppController.php +++ b/app/Controller/AppController.php @@ -201,7 +201,8 @@ protected function errorFlash($errors) { * */ protected function sendSlack($msg, $extra = []) { - if (!env('SLACK_ENDPOINT')) { return; + if (!env('SLACK_ENDPOINT')) { + return; } // Sprintf it diff --git a/app/Controller/Component/AuthComponent.php b/app/Controller/Component/AuthComponent.php index bb9f472..4047133 100644 --- a/app/Controller/Component/AuthComponent.php +++ b/app/Controller/Component/AuthComponent.php @@ -62,20 +62,24 @@ public function login($username, $password) { $user = $UserModel->findByUsername($username); // Does the user exist? - if (empty($user)) { return false; + if (empty($user)) { + return false; } // Do we have the right password? $actual_password = $user['User']['password']; - if (Security::hash($password, 'blowfish', $actual_password) !== $actual_password) { return false; + if (Security::hash($password, 'blowfish', $actual_password) !== $actual_password) { + return false; } // Is the user active? - if ($user['User']['active'] == 0) { return false; + if ($user['User']['active'] == 0) { + return false; } // Is the user expired? - if ($this->isExpired($user['User']['expiration'])) { return false; + if ($this->isExpired($user['User']['expiration'])) { + return false; } // Save the data diff --git a/app/Controller/PagesController.php b/app/Controller/PagesController.php index e4caad5..6c6bf1c 100644 --- a/app/Controller/PagesController.php +++ b/app/Controller/PagesController.php @@ -24,7 +24,8 @@ public function index() { * @url /pages/announcement_read */ public function announcement_read($aid = false) { - if ($aid == false || !is_numeric($aid)) { return $this->ajaxResponse(null); + if ($aid == false || !is_numeric($aid)) { + return $this->ajaxResponse(null); } $read = $this->Session->consume('read_announcements'); diff --git a/app/Controller/UserController.php b/app/Controller/UserController.php index fcf42aa..4704eed 100644 --- a/app/Controller/UserController.php +++ b/app/Controller/UserController.php @@ -11,7 +11,8 @@ class UserController extends AppController { * @url /user/login */ public function login() { - if ($this->Auth->loggedIn()) { return $this->redirect('/'); + if ($this->Auth->loggedIn()) { + return $this->redirect('/'); } $username = ''; diff --git a/app/Lib/InjectAbstraction.php b/app/Lib/InjectAbstraction.php index e3658f5..d276774 100644 --- a/app/Lib/InjectAbstraction.php +++ b/app/Lib/InjectAbstraction.php @@ -122,7 +122,8 @@ public function getStartString() { return ($this->getStart() > 0 ? tz_date(self::DATE_FORMAT, $this->getStart()) : self::STR_IMMEDIATELY); } public function getManagerStartString() { - if (!$this->isFuzzy() || $this->getStart() == 0) { return $this->getStartString(); + if (!$this->isFuzzy() || $this->getStart() == 0) { + return $this->getStartString(); } return $this->fuzzyDuration('+', $this->getStart()); @@ -147,7 +148,8 @@ public function getEndString() { return ($this->getEnd() > 0 ? tz_date(self::DATE_FORMAT, $this->getEnd()) : self::STR_NEVER); } public function getManagerEndString() { - if (!$this->isFuzzy() || $this->getEnd() == 0) { return $this->getEndString(); + if (!$this->isFuzzy() || $this->getEnd() == 0) { + return $this->getEndString(); } return $this->fuzzyDuration('+', $this->getEnd()); @@ -160,9 +162,11 @@ public function getManagerEndString() { * form of minutes */ public function getDuration() { - if ($this->getEnd() == 0) { return 0; + if ($this->getEnd() == 0) { + return 0; } - if ($this->getStart() == 0) { return -1; + if ($this->getStart() == 0) { + return -1; } $duration = ($this->getEnd() - $this->getStart()); @@ -219,9 +223,8 @@ public function getAttachments() { * @return mixed The data you're looking for */ public function __call($name, $args) { - if (count($args) > 0) { return; - } - if (substr($name, 0, 3) != 'get') { return; + if (count($args) > 0 || substr($name, 0, 3) != 'get') { + return; } $key = Inflector::underscore(substr($name, 3)); diff --git a/app/Plugin/BankWeb/Config/Schema/schema.php b/app/Plugin/BankWeb/Config/Schema/schema.php index a973506..ac89db5 100644 --- a/app/Plugin/BankWeb/Config/Schema/schema.php +++ b/app/Plugin/BankWeb/Config/Schema/schema.php @@ -34,7 +34,8 @@ public function before($event = []) { } public function after($event = []) { - if (!isset($event['create'])) { return; + if (!isset($event['create'])) { + return; } switch ($event['create']) { diff --git a/app/View/Helper/MiscHelper.php b/app/View/Helper/MiscHelper.php index 6716676..7b95307 100644 --- a/app/View/Helper/MiscHelper.php +++ b/app/View/Helper/MiscHelper.php @@ -12,7 +12,8 @@ public function navbarItem($name, $url, $active = false) { } public function navbarDropdown($name, $active, $children) { - if (empty(array_filter($children))) { return ''; + if (empty(array_filter($children))) { + return ''; } return sprintf(self::NAVBAR_MENU, ($active ? 'active' : ''), $name, implode('', $children));