From 092c5780ea37000cc91943f9e8aef31dd018ae14 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 2 Sep 2013 17:33:12 +0200 Subject: [PATCH] CS: Fix violations for overdue files refs #4586 --- .../Config/Authentication/DbBackendForm.php | 14 ++++++----- library/Icinga/Protocol/Statusdat/Query.php | 2 +- library/Icinga/Protocol/Statusdat/Reader.php | 6 ++--- .../Statusdat/View/MonitoringObjectList.php | 24 ++++++++++++------- .../Statusdat/View/ObjectRemappingView.php | 3 ++- library/Icinga/Util/Format.php | 8 +++++-- 6 files changed, 35 insertions(+), 22 deletions(-) diff --git a/application/forms/Config/Authentication/DbBackendForm.php b/application/forms/Config/Authentication/DbBackendForm.php index c49205161..658e7c3d1 100644 --- a/application/forms/Config/Authentication/DbBackendForm.php +++ b/application/forms/Config/Authentication/DbBackendForm.php @@ -127,13 +127,15 @@ class DbBackendForm extends BaseBackendForm { try { $name = $this->getBackendName(); - $dbBackend = new DbUserBackend(new Zend_Config( - array( - 'backend' => 'db', - 'target' => 'user', - 'resource' => $this->getValue('backend_' . $this->filterName($name) . '_resource'), + $dbBackend = new DbUserBackend( + new Zend_Config( + array( + 'backend' => 'db', + 'target' => 'user', + 'resource' => $this->getValue('backend_' . $this->filterName($name) . '_resource'), + ) ) - )); + ); if ($dbBackend->getUserCount() < 1) { $this->addErrorMessage("No users found under the specified database backend"); return false; diff --git a/library/Icinga/Protocol/Statusdat/Query.php b/library/Icinga/Protocol/Statusdat/Query.php index 90c34486c..fa913ff5d 100755 --- a/library/Icinga/Protocol/Statusdat/Query.php +++ b/library/Icinga/Protocol/Statusdat/Query.php @@ -30,6 +30,7 @@ namespace Icinga\Protocol\Statusdat; use Icinga\Protocol; use Icinga\Data\AbstractQuery; + /** * Class Query * @package Icinga\Protocol\Statusdat @@ -398,5 +399,4 @@ class Query extends AbstractQuery } return $result; } - } diff --git a/library/Icinga/Protocol/Statusdat/Reader.php b/library/Icinga/Protocol/Statusdat/Reader.php index c079c0048..4a266e131 100755 --- a/library/Icinga/Protocol/Statusdat/Reader.php +++ b/library/Icinga/Protocol/Statusdat/Reader.php @@ -30,9 +30,10 @@ namespace Icinga\Protocol\Statusdat; use Icinga\Data\DatasourceInterface; -use Icinga\Exception as Exception; -use Icinga\Benchmark as Benchmark; +use Icinga\Exception; +use Icinga\Benchmark; use Icinga\Protocol\Statusdat\View\MonitoringObjectList; + /** * Class Reader * @package Icinga\Protocol\Statusdat @@ -319,5 +320,4 @@ class Reader implements IReader, DatasourceInterface { return isset($this->lastState[$type]) ? array_keys($this->lastState[$type]) : null; } - } diff --git a/library/Icinga/Protocol/Statusdat/View/MonitoringObjectList.php b/library/Icinga/Protocol/Statusdat/View/MonitoringObjectList.php index 7ddf86fe2..441ae61aa 100755 --- a/library/Icinga/Protocol/Statusdat/View/MonitoringObjectList.php +++ b/library/Icinga/Protocol/Statusdat/View/MonitoringObjectList.php @@ -11,15 +11,21 @@ * If the dataset contains arrays instead of objects, they will be cast to objects. * */ + namespace Icinga\Protocol\Statusdat\View; -class MonitoringObjectList implements \Iterator, \Countable, \ArrayAccess +use \Iterator; +use \Countable; +use \ArrayAccess; +use \Exception; + +class MonitoringObjectList implements Iterator, Countable, ArrayAccess { private $dataSet = array(); private $position = 0; private $dataView = null; - function __construct(array &$dataset, AccessorStrategy $dataView = null) + public function __construct(array &$dataset, AccessorStrategy $dataView = null) { $this->dataSet = $dataset; $this->position = 0; @@ -44,8 +50,9 @@ class MonitoringObjectList implements \Iterator, \Countable, \ArrayAccess */ public function current() { - if ($this->dataView) + if ($this->dataView) { return $this; + } return $this->dataSet[$this->position]; } @@ -96,17 +103,17 @@ class MonitoringObjectList implements \Iterator, \Countable, \ArrayAccess public function __isset($name) { - return $this->dataView->exists($this->dataSet[$this->position],$name); + return $this->dataView->exists($this->dataSet[$this->position], $name); } - function __get($name) + public function __get($name) { - return $this->dataView->get($this->dataSet[$this->position],$name); + return $this->dataView->get($this->dataSet[$this->position], $name); } - function __set($name, $value) + public function __set($name, $value) { - throw new \Exception("Setting is currently not available for objects"); + throw new Exception("Setting is currently not available for objects"); } public function offsetExists($offset) @@ -130,5 +137,4 @@ class MonitoringObjectList implements \Iterator, \Countable, \ArrayAccess { // non mutable } - } diff --git a/library/Icinga/Protocol/Statusdat/View/ObjectRemappingView.php b/library/Icinga/Protocol/Statusdat/View/ObjectRemappingView.php index 44e6f81c6..1a216fad6 100755 --- a/library/Icinga/Protocol/Statusdat/View/ObjectRemappingView.php +++ b/library/Icinga/Protocol/Statusdat/View/ObjectRemappingView.php @@ -99,8 +99,9 @@ class ObjectRemappingView implements AccessorStrategy private function applyPropertyFunction($function, $value) { - if (!isset($this->functionMap[$function])) + if (!isset($this->functionMap[$function])) { return $value; + } $fn = $this->functionMap[$function]; return $this->$fn($value); diff --git a/library/Icinga/Util/Format.php b/library/Icinga/Util/Format.php index f7986d5c3..ef0f43d86 100644 --- a/library/Icinga/Util/Format.php +++ b/library/Icinga/Util/Format.php @@ -48,7 +48,9 @@ class Format public static function duration($duration) { - if (! $duration) return '-'; + if (! $duration) { + return '-'; + } return self::showHourMin($duration); } @@ -67,7 +69,9 @@ class Format public static function timeSince($timestamp) { - if (! $timestamp) return '-'; + if (! $timestamp) { + return '-'; + } $duration = time() - $timestamp; $prefix = ''; if ($duration < 0) {