Add docstrings to ObjectList and coding style

This commit is contained in:
Matthias Jentsch 2015-04-07 16:32:34 +02:00
parent 1c5a091584
commit 46da404452
3 changed files with 57 additions and 2 deletions

View File

@ -9,7 +9,8 @@ namespace Icinga\Protocol\Ldap;
* Provides information about the available encryption mechanisms (StartTLS), the supported * Provides information about the available encryption mechanisms (StartTLS), the supported
* LDAP protocol (v2/v3), vendor-specific extensions or protocols controls and extensions. * 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'; const LDAP_SERVER_START_TLS_OID = '1.3.6.1.4.1.1466.20037';

View File

@ -6,7 +6,8 @@ namespace Icinga\Util;
/** /**
* Provide functions to change and convert colors. * Provide functions to change and convert colors.
*/ */
class Color { class Color
{
/** /**
* Convert a given color string to an rgb-array containing * Convert a given color string to an rgb-array containing
* each color as a decimal value. * each color as a decimal value.

View File

@ -5,21 +5,40 @@ namespace Icinga\Module\Monitoring\Object;
use ArrayIterator; use ArrayIterator;
use Countable; use Countable;
use Icinga\Data\Filter\Filter;
use IteratorAggregate; use IteratorAggregate;
use Icinga\Module\Monitoring\Backend\MonitoringBackend; use Icinga\Module\Monitoring\Backend\MonitoringBackend;
abstract class ObjectList implements Countable, IteratorAggregate abstract class ObjectList implements Countable, IteratorAggregate
{ {
/**
* @var string
*/
protected $dataViewName; protected $dataViewName;
/**
* @var MonitoringBackend
*/
protected $backend; protected $backend;
/**
* @var array
*/
protected $columns; protected $columns;
/**
* @var Filter
*/
protected $filter; protected $filter;
/**
* @var array
*/
protected $objects; protected $objects;
/**
* @var int
*/
protected $count; protected $count;
public function __construct(MonitoringBackend $backend) public function __construct(MonitoringBackend $backend)
@ -27,23 +46,39 @@ abstract class ObjectList implements Countable, IteratorAggregate
$this->backend = $backend; $this->backend = $backend;
} }
/**
* @param array $columns
*
* @return $this
*/
public function setColumns(array $columns) public function setColumns(array $columns)
{ {
$this->columns = $columns; $this->columns = $columns;
return $this; return $this;
} }
/**
* @return array
*/
public function getColumns() public function getColumns()
{ {
return $this->columns; return $this->columns;
} }
/**
* @param $filter
*
* @return $this
*/
public function setFilter($filter) public function setFilter($filter)
{ {
$this->filter = $filter; $this->filter = $filter;
return $this; return $this;
} }
/**
* @return Filter
*/
public function getFilter() public function getFilter()
{ {
return $this->filter; return $this->filter;
@ -51,6 +86,9 @@ abstract class ObjectList implements Countable, IteratorAggregate
abstract protected function fetchObjects(); abstract protected function fetchObjects();
/**
* @return array
*/
public function fetch() public function fetch()
{ {
if ($this->objects === null) { if ($this->objects === null) {
@ -59,6 +97,9 @@ abstract class ObjectList implements Countable, IteratorAggregate
return $this->objects; return $this->objects;
} }
/**
* @return int
*/
public function count() public function count()
{ {
if ($this->count === null) { if ($this->count === null) {
@ -86,6 +127,9 @@ abstract class ObjectList implements Countable, IteratorAggregate
return $this->backend->select()->from('comment')->applyFilter($this->filter); return $this->backend->select()->from('comment')->applyFilter($this->filter);
} }
/**
* @return ObjectList
*/
public function getAcknowledgedObjects() public function getAcknowledgedObjects()
{ {
$acknowledgedObjects = array(); $acknowledgedObjects = array();
@ -97,6 +141,9 @@ abstract class ObjectList implements Countable, IteratorAggregate
return $this->newFromArray($acknowledgedObjects); return $this->newFromArray($acknowledgedObjects);
} }
/**
* @return ObjectList
*/
public function getObjectsInDowntime() public function getObjectsInDowntime()
{ {
$objectsInDowntime = array(); $objectsInDowntime = array();
@ -108,6 +155,9 @@ abstract class ObjectList implements Countable, IteratorAggregate
return $this->newFromArray($objectsInDowntime); return $this->newFromArray($objectsInDowntime);
} }
/**
* @return ObjectList
*/
public function getUnhandledObjects() public function getUnhandledObjects()
{ {
$unhandledObjects = array(); $unhandledObjects = array();
@ -148,5 +198,8 @@ abstract class ObjectList implements Countable, IteratorAggregate
return $list; return $list;
} }
/**
* @return Filter
*/
abstract function filterFromResult(); abstract function filterFromResult();
} }