From 46da40445267394a38aec18549672291c94ddf28 Mon Sep 17 00:00:00 2001 From: Matthias Jentsch Date: Tue, 7 Apr 2015 16:32:34 +0200 Subject: [PATCH] Add docstrings to ObjectList and coding style --- library/Icinga/Protocol/Ldap/Capability.php | 3 +- library/Icinga/Util/Color.php | 3 +- .../library/Monitoring/Object/ObjectList.php | 53 +++++++++++++++++++ 3 files changed, 57 insertions(+), 2 deletions(-) diff --git a/library/Icinga/Protocol/Ldap/Capability.php b/library/Icinga/Protocol/Ldap/Capability.php index 76d1f11a0..16825e4f2 100644 --- a/library/Icinga/Protocol/Ldap/Capability.php +++ b/library/Icinga/Protocol/Ldap/Capability.php @@ -9,7 +9,8 @@ namespace Icinga\Protocol\Ldap; * Provides information about the available encryption mechanisms (StartTLS), the supported * LDAP protocol (v2/v3), vendor-specific extensions or protocols controls and extensions. */ -class Capability { +class Capability +{ const LDAP_SERVER_START_TLS_OID = '1.3.6.1.4.1.1466.20037'; diff --git a/library/Icinga/Util/Color.php b/library/Icinga/Util/Color.php index 5bc2f2815..616bb308a 100644 --- a/library/Icinga/Util/Color.php +++ b/library/Icinga/Util/Color.php @@ -6,7 +6,8 @@ namespace Icinga\Util; /** * Provide functions to change and convert colors. */ -class Color { +class Color +{ /** * Convert a given color string to an rgb-array containing * each color as a decimal value. diff --git a/modules/monitoring/library/Monitoring/Object/ObjectList.php b/modules/monitoring/library/Monitoring/Object/ObjectList.php index 4a375e70d..9d81be371 100644 --- a/modules/monitoring/library/Monitoring/Object/ObjectList.php +++ b/modules/monitoring/library/Monitoring/Object/ObjectList.php @@ -5,21 +5,40 @@ namespace Icinga\Module\Monitoring\Object; use ArrayIterator; use Countable; +use Icinga\Data\Filter\Filter; use IteratorAggregate; use Icinga\Module\Monitoring\Backend\MonitoringBackend; abstract class ObjectList implements Countable, IteratorAggregate { + /** + * @var string + */ protected $dataViewName; + /** + * @var MonitoringBackend + */ protected $backend; + /** + * @var array + */ protected $columns; + /** + * @var Filter + */ protected $filter; + /** + * @var array + */ protected $objects; + /** + * @var int + */ protected $count; public function __construct(MonitoringBackend $backend) @@ -27,23 +46,39 @@ abstract class ObjectList implements Countable, IteratorAggregate $this->backend = $backend; } + /** + * @param array $columns + * + * @return $this + */ public function setColumns(array $columns) { $this->columns = $columns; return $this; } + /** + * @return array + */ public function getColumns() { return $this->columns; } + /** + * @param $filter + * + * @return $this + */ public function setFilter($filter) { $this->filter = $filter; return $this; } + /** + * @return Filter + */ public function getFilter() { return $this->filter; @@ -51,6 +86,9 @@ abstract class ObjectList implements Countable, IteratorAggregate abstract protected function fetchObjects(); + /** + * @return array + */ public function fetch() { if ($this->objects === null) { @@ -59,6 +97,9 @@ abstract class ObjectList implements Countable, IteratorAggregate return $this->objects; } + /** + * @return int + */ public function count() { if ($this->count === null) { @@ -86,6 +127,9 @@ abstract class ObjectList implements Countable, IteratorAggregate return $this->backend->select()->from('comment')->applyFilter($this->filter); } + /** + * @return ObjectList + */ public function getAcknowledgedObjects() { $acknowledgedObjects = array(); @@ -97,6 +141,9 @@ abstract class ObjectList implements Countable, IteratorAggregate return $this->newFromArray($acknowledgedObjects); } + /** + * @return ObjectList + */ public function getObjectsInDowntime() { $objectsInDowntime = array(); @@ -108,6 +155,9 @@ abstract class ObjectList implements Countable, IteratorAggregate return $this->newFromArray($objectsInDowntime); } + /** + * @return ObjectList + */ public function getUnhandledObjects() { $unhandledObjects = array(); @@ -148,5 +198,8 @@ abstract class ObjectList implements Countable, IteratorAggregate return $list; } + /** + * @return Filter + */ abstract function filterFromResult(); }