Skip to content

Commit

Permalink
Add docstrings to ObjectList and coding style
Browse files Browse the repository at this point in the history
  • Loading branch information
majentsch committed Apr 7, 2015
1 parent 1c5a091 commit 46da404
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 2 deletions.
3 changes: 2 additions & 1 deletion library/Icinga/Protocol/Ldap/Capability.php
Expand Up @@ -9,7 +9,8 @@
* 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';

Expand Down
3 changes: 2 additions & 1 deletion library/Icinga/Util/Color.php
Expand Up @@ -6,7 +6,8 @@
/**
* 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.
Expand Down
53 changes: 53 additions & 0 deletions modules/monitoring/library/Monitoring/Object/ObjectList.php
Expand Up @@ -5,52 +5,90 @@

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)
{
$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;
}

abstract protected function fetchObjects();

/**
* @return array
*/
public function fetch()
{
if ($this->objects === null) {
Expand All @@ -59,6 +97,9 @@ public function fetch()
return $this->objects;
}

/**
* @return int
*/
public function count()
{
if ($this->count === null) {
Expand Down Expand Up @@ -86,6 +127,9 @@ public function getComments()
return $this->backend->select()->from('comment')->applyFilter($this->filter);
}

/**
* @return ObjectList
*/
public function getAcknowledgedObjects()
{
$acknowledgedObjects = array();
Expand All @@ -97,6 +141,9 @@ public function getAcknowledgedObjects()
return $this->newFromArray($acknowledgedObjects);
}

/**
* @return ObjectList
*/
public function getObjectsInDowntime()
{
$objectsInDowntime = array();
Expand All @@ -108,6 +155,9 @@ public function getObjectsInDowntime()
return $this->newFromArray($objectsInDowntime);
}

/**
* @return ObjectList
*/
public function getUnhandledObjects()
{
$unhandledObjects = array();
Expand Down Expand Up @@ -148,5 +198,8 @@ protected function newFromArray(array $objects)
return $list;
}

/**
* @return Filter
*/
abstract function filterFromResult();
}

0 comments on commit 46da404

Please sign in to comment.