From 9acdba0dc452624175195af631c3779ad41d1d07 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Wed, 23 Nov 2016 11:13:29 +0100 Subject: [PATCH] various: fix some phpcs PSR2 complaints --- application/views/helpers/RenderStateBadges.php | 14 +++++++++++--- .../Businessprocess/Storage/LegacyStorage.php | 17 +++++++++++------ .../Businessprocess/Web/Component/ActionBar.php | 2 +- .../Web/Component/Attributes.php | 4 ++-- .../Businessprocess/Web/Component/Component.php | 4 ++-- .../Businessprocess/Web/Component/Container.php | 2 +- library/Businessprocess/Web/Component/Link.php | 2 +- 7 files changed, 29 insertions(+), 16 deletions(-) diff --git a/application/views/helpers/RenderStateBadges.php b/application/views/helpers/RenderStateBadges.php index 14db762..7a4d708 100644 --- a/application/views/helpers/RenderStateBadges.php +++ b/application/views/helpers/RenderStateBadges.php @@ -1,15 +1,23 @@ $cnt) { - if ($cnt === 0) continue; - if ($state === 'OK') continue; - if ($state === 'UP') continue; + if ($cnt === 0 + || $state === 'OK' + ||$ state === 'UP' + ) { + continue; + } + $html .= '' . $cnt . ''; diff --git a/library/Businessprocess/Storage/LegacyStorage.php b/library/Businessprocess/Storage/LegacyStorage.php index 5e1e533..7309948 100644 --- a/library/Businessprocess/Storage/LegacyStorage.php +++ b/library/Businessprocess/Storage/LegacyStorage.php @@ -67,7 +67,10 @@ class LegacyStorage extends Storage $files = array(); foreach (new DirectoryIterator($this->getConfigDir()) as $file) { - if($file->isDot()) continue; + if ($file->isDot()) { + continue; + } + $filename = $file->getFilename(); if (substr($filename, -5) === '.conf') { $name = substr($filename, 0, -5); @@ -94,8 +97,7 @@ class LegacyStorage extends Storage return true; } - if ( - $header['Allowed users'] === null + if ($header['Allowed users'] === null && $header['Allowed groups'] === null && $header['Allowed roles'] === null ) { @@ -336,18 +338,21 @@ class LegacyStorage extends Storage $op_name = $op; if ($op === '+') { - if (! preg_match('~^(\d+)\s*of:\s*(.+?)$~', $value, $m)) { + if (! preg_match('~^(\d+)(?::(\d+))?\s*of:\s*(.+?)$~', $value, $m)) { $this->parseError('syntax: = of: + [+ ]*'); } $op_name = $m[1]; - $value = $m[2]; + // New feature: $minWarn = $m[2]; + $value = $m[3]; } $cmps = preg_split('~\s*\\' . $op . '\s*~', $value, -1, PREG_SPLIT_NO_EMPTY); $childNames = array(); foreach ($cmps as $val) { if (strpos($val, ';') !== false) { - if ($bp->hasNode($val)) continue; + if ($bp->hasNode($val)) { + continue; + } list($host, $service) = preg_split('~;~', $val, 2); if ($service === 'Hoststatus') { diff --git a/library/Businessprocess/Web/Component/ActionBar.php b/library/Businessprocess/Web/Component/ActionBar.php index 0a71df0..887e06f 100644 --- a/library/Businessprocess/Web/Component/ActionBar.php +++ b/library/Businessprocess/Web/Component/ActionBar.php @@ -7,4 +7,4 @@ class ActionBar extends Container protected $separator = ' '; protected $attributes = array('class' => 'action-bar'); -} \ No newline at end of file +} diff --git a/library/Businessprocess/Web/Component/Attributes.php b/library/Businessprocess/Web/Component/Attributes.php index 1c073b7..c0c8039 100644 --- a/library/Businessprocess/Web/Component/Attributes.php +++ b/library/Businessprocess/Web/Component/Attributes.php @@ -110,7 +110,7 @@ class Attributes extends Component } return $this; - } else if ($attribute instanceof Attribute) { + } elseif ($attribute instanceof Attribute) { return $this->setAttribute($attribute); } else { return $this->setAttribute(new Attribute($attribute, $value)); @@ -155,4 +155,4 @@ class Attributes extends Component return ' ' . implode(' ', $this->attributes); } -} \ No newline at end of file +} diff --git a/library/Businessprocess/Web/Component/Component.php b/library/Businessprocess/Web/Component/Component.php index fb7d873..3830e06 100644 --- a/library/Businessprocess/Web/Component/Component.php +++ b/library/Businessprocess/Web/Component/Component.php @@ -56,7 +56,7 @@ abstract class Component /** * @return string */ - abstract function render(); + abstract public function render(); public function wantHtml($any, $separator = '') { @@ -131,4 +131,4 @@ abstract class Component return $this->renderError($e); } } -} \ No newline at end of file +} diff --git a/library/Businessprocess/Web/Component/Container.php b/library/Businessprocess/Web/Component/Container.php index b4d90d4..69cce5a 100644 --- a/library/Businessprocess/Web/Component/Container.php +++ b/library/Businessprocess/Web/Component/Container.php @@ -141,4 +141,4 @@ class Container extends Component $this->tag ); } -} \ No newline at end of file +} diff --git a/library/Businessprocess/Web/Component/Link.php b/library/Businessprocess/Web/Component/Link.php index fa9e2fc..525694c 100644 --- a/library/Businessprocess/Web/Component/Link.php +++ b/library/Businessprocess/Web/Component/Link.php @@ -73,4 +73,4 @@ class Link extends Component $this->getRenderedText() ); } -} \ No newline at end of file +}