Ldap\Connection: Fix existing documentation

Part #1

refs #8954
This commit is contained in:
Johannes Meyer 2015-06-23 17:12:24 +02:00
parent 778bf376b2
commit 02ee460c08

View File

@ -14,18 +14,7 @@ use Icinga\Exception\ProgrammingError;
use Icinga\Protocol\Ldap\Exception as LdapException; use Icinga\Protocol\Ldap\Exception as LdapException;
/** /**
* Backend class managing all the LDAP stuff for you. * Encapsulate LDAP connections and query creation
*
* Usage example:
*
* <code>
* $lconf = new Connection((object) array(
* 'hostname' => 'localhost',
* 'root_dn' => 'dc=monitoring,dc=...',
* 'bind_dn' => 'cn=Mangager,dc=monitoring,dc=...',
* 'bind_pw' => '***'
* ));
* </code>
*/ */
class Connection implements Selectable class Connection implements Selectable
{ {
@ -83,7 +72,7 @@ class Connection implements Selectable
/** /**
* Encryption for the connection if any * Encryption for the connection if any
* *
* @var string|null * @var string
*/ */
protected $encryption; protected $encryption;
@ -108,7 +97,7 @@ class Connection implements Selectable
protected $reqCert = true; protected $reqCert = true;
/** /**
* Whether the bind on this connection was already performed * Whether the bind on this connection has already been performed
* *
* @var bool * @var bool
*/ */
@ -136,7 +125,7 @@ class Connection implements Selectable
protected $discoverySuccess = false; protected $discoverySuccess = false;
/** /**
* Constructor * Create a new connection object
* *
* @param ConfigObject $config * @param ConfigObject $config
*/ */
@ -365,12 +354,13 @@ class Connection implements Selectable
} }
/** /**
* Fetch the distinguished name of the first result of the given query * Fetch the distinguished name of the result of the given query
* *
* @param Query $query The query returning the result set * @param Query $query The query returning the result set
* *
* @return string Returns the distinguished name, or false when the given query yields no results * @return string The distinguished name, or false when the given query yields no results
* @throws LdapException When the query result is empty and contains no DN to fetch *
* @throws LdapException In case the query yields multiple results
*/ */
public function fetchDn(Query $query) public function fetchDn(Query $query)
{ {
@ -514,16 +504,17 @@ class Connection implements Selectable
} }
/** /**
* Execute the given LDAP query while requesting pagination control to separate * Run the given LDAP query and return the resulting entries
* big responses into smaller chunks
* *
* @param Query $query The query to execute * This utilizes paged search requests as defined in RFC 2696.
* @param array $fields The fields that will be fetched from the matches
* @param int $pageSize The maximum page size, defaults to Connection::PAGE_SIZE
* *
* @return array The matched entries * @param Query $query The query to fetch results with
* @throws LdapException * @param array $fields Request these attributes instead of the ones registered in the given query
* @throws ProgrammingError When executed without available page controls (check with pageControlAvailable() ) * @param int $pageSize The maximum page size, defaults to self::PAGE_SIZE
*
* @return array
*
* @throws LdapException In case an error occured while fetching the results
*/ */
protected function runPagedQuery(Query $query, array $fields = null, $pageSize = null) protected function runPagedQuery(Query $query, array $fields = null, $pageSize = null)
{ {