From 2274b6e11ed267eef4aa1e80f9241204705203d7 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 2 Jun 2014 15:46:15 +0200 Subject: [PATCH] lib: Add phpdoc to class `AuthChain' refs #5685 --- library/Icinga/Authentication/AuthChain.php | 41 +++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/library/Icinga/Authentication/AuthChain.php b/library/Icinga/Authentication/AuthChain.php index 99e5de13c..8f34ed84b 100644 --- a/library/Icinga/Authentication/AuthChain.php +++ b/library/Icinga/Authentication/AuthChain.php @@ -7,40 +7,81 @@ use Zend_Config; use Icinga\Logger\Logger; use Icinga\Exception\ConfigurationError; +/** + * Iterate user backends created from config + */ class AuthChain implements Iterator { + /** + * User backends configuration + * + * @var Zend_Config + */ private $config; + /** + * The consecutive user backend while looping + * + * @var UserBackend + */ private $currentBackend; + /** + * Create a new authentication chain from config + * + * @param Zend_Config $config User backends configuration + */ public function __construct(Zend_Config $config) { $this->config = $config; } + /** + * Rewind the chain + */ public function rewind() { $this->config->rewind(); + $this->currentBackend = null; } + /** + * Return the current user backend + * + * @return UserBackend + */ public function current() { return $this->currentBackend; } + /** + * Return the key of the current user backend config + * + * @return string + */ public function key() { return $this->config->key(); } + /** + * Move forward to the next user backend config + */ public function next() { $this->config->next(); } + /** + * Check if the current user backend is valid, i.e. it's enabled and the config's valid + * + * @return bool + */ public function valid() { if (!$this->config->valid()) { + // Stop when there are no more backends to check return false; } $backendConfig = $this->config->current();