Skip to content
This repository has been archived by the owner on Oct 5, 2021. It is now read-only.

Commit

Permalink
Fixing some Code Sniffing
Browse files Browse the repository at this point in the history
  • Loading branch information
jtdroste committed Apr 19, 2017
1 parent 9cf636d commit f034658
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 16 deletions.
3 changes: 2 additions & 1 deletion app/Controller/AppController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 8 additions & 4 deletions app/Controller/Component/AuthComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion app/Controller/PagesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
3 changes: 2 additions & 1 deletion app/Controller/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '';
Expand Down
17 changes: 10 additions & 7 deletions app/Lib/InjectAbstraction.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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());
Expand All @@ -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());
Expand Down Expand Up @@ -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));
Expand Down
3 changes: 2 additions & 1 deletion app/Plugin/BankWeb/Config/Schema/schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']) {
Expand Down
3 changes: 2 additions & 1 deletion app/View/Helper/MiscHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit f034658

Please sign in to comment.