CS: Fix violations for overdue files

refs #4586
This commit is contained in:
Eric Lippmann 2013-09-02 17:33:12 +02:00 committed by Jannis Moßhammer
parent 8a062ff3e5
commit 092c5780ea
6 changed files with 35 additions and 22 deletions

View File

@ -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;

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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
}
}

View File

@ -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);

View File

@ -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) {