Ldap\Query: Rename to LdapQuery

refs #8954
This commit is contained in:
Johannes Meyer 2015-06-24 09:14:25 +02:00
parent c3ad7b211a
commit 5dea14f04b
2 changed files with 37 additions and 37 deletions

View File

@ -282,21 +282,21 @@ class LdapConnection implements Selectable
/** /**
* Provide a query on this connection * Provide a query on this connection
* *
* @return Query * @return LdapQuery
*/ */
public function select() public function select()
{ {
return new Query($this); return new LdapQuery($this);
} }
/** /**
* Fetch and return all rows of the given query's result set using an iterator * Fetch and return all rows of the given query's result set using an iterator
* *
* @param Query $query The query returning the result set * @param LdapQuery $query The query returning the result set
* *
* @return ArrayIterator * @return ArrayIterator
*/ */
public function query(Query $query) public function query(LdapQuery $query)
{ {
return new ArrayIterator($this->fetchAll($query)); return new ArrayIterator($this->fetchAll($query));
} }
@ -304,11 +304,11 @@ class LdapConnection implements Selectable
/** /**
* Count all rows of the given query's result set * Count all rows of the given query's result set
* *
* @param Query $query The query returning the result set * @param LdapQuery $query The query returning the result set
* *
* @return int * @return int
*/ */
public function count(Query $query) public function count(LdapQuery $query)
{ {
$this->connect(); $this->connect();
$this->bind(); $this->bind();
@ -320,12 +320,12 @@ class LdapConnection implements Selectable
/** /**
* Retrieve an array containing all rows of the result set * Retrieve an array containing all rows of the result set
* *
* @param Query $query The query returning the result set * @param LdapQuery $query The query returning the result set
* @param array $fields Request these attributes instead of the ones registered in the given query * @param array $fields Request these attributes instead of the ones registered in the given query
* *
* @return array * @return array
*/ */
public function fetchAll(Query $query, array $fields = null) public function fetchAll(LdapQuery $query, array $fields = null)
{ {
$this->connect(); $this->connect();
$this->bind(); $this->bind();
@ -344,12 +344,12 @@ class LdapConnection implements Selectable
/** /**
* Fetch the first row of the result set * Fetch the first row of the result set
* *
* @param Query $query The query returning the result set * @param LdapQuery $query The query returning the result set
* @param array $fields Request these attributes instead of the ones registered in the given query * @param array $fields Request these attributes instead of the ones registered in the given query
* *
* @return mixed * @return mixed
*/ */
public function fetchRow(Query $query, array $fields = null) public function fetchRow(LdapQuery $query, array $fields = null)
{ {
$clonedQuery = clone $query; $clonedQuery = clone $query;
$clonedQuery->limit(1); $clonedQuery->limit(1);
@ -361,14 +361,14 @@ class LdapConnection implements Selectable
/** /**
* Fetch the first column of all rows of the result set as an array * Fetch the first column of all rows of the result set as an array
* *
* @param Query $query The query returning the result set * @param LdapQuery $query The query returning the result set
* @param array $fields Request these attributes instead of the ones registered in the given query * @param array $fields Request these attributes instead of the ones registered in the given query
* *
* @return array * @return array
* *
* @throws ProgrammingError In case no attribute is being requested * @throws ProgrammingError In case no attribute is being requested
*/ */
public function fetchColumn(Query $query, array $fields = null) public function fetchColumn(LdapQuery $query, array $fields = null)
{ {
if ($fields === null) { if ($fields === null) {
$fields = $query->getColumns(); $fields = $query->getColumns();
@ -393,12 +393,12 @@ class LdapConnection implements Selectable
/** /**
* Fetch the first column of the first row of the result set * Fetch the first column of the first row of the result set
* *
* @param Query $query The query returning the result set * @param LdapQuery $query The query returning the result set
* @param array $fields Request these attributes instead of the ones registered in the given query * @param array $fields Request these attributes instead of the ones registered in the given query
* *
* @return string * @return string
*/ */
public function fetchOne(Query $query, array $fields = null) public function fetchOne(LdapQuery $query, array $fields = null)
{ {
$row = (array) $this->fetchRow($query, $fields); $row = (array) $this->fetchRow($query, $fields);
return array_shift($row) ?: false; return array_shift($row) ?: false;
@ -409,14 +409,14 @@ class LdapConnection implements Selectable
* *
* The first column is the key, the second column is the value. * The first column is the key, the second column is the value.
* *
* @param Query $query The query returning the result set * @param LdapQuery $query The query returning the result set
* @param array $fields Request these attributes instead of the ones registered in the given query * @param array $fields Request these attributes instead of the ones registered in the given query
* *
* @return array * @return array
* *
* @throws ProgrammingError In case there are less than two attributes being requested * @throws ProgrammingError In case there are less than two attributes being requested
*/ */
public function fetchPairs(Query $query, array $fields = null) public function fetchPairs(LdapQuery $query, array $fields = null)
{ {
if ($fields === null) { if ($fields === null) {
$fields = $query->getColumns(); $fields = $query->getColumns();
@ -564,13 +564,13 @@ class LdapConnection implements Selectable
/** /**
* Fetch the distinguished name of the 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 LdapQuery $query The query returning the result set
* *
* @return string 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 In case the query yields multiple results * @throws LdapException In case the query yields multiple results
*/ */
public function fetchDn(Query $query) public function fetchDn(LdapQuery $query)
{ {
$rows = $this->fetchAll($query, array()); $rows = $this->fetchAll($query, array());
if (count($rows) > 1) { if (count($rows) > 1) {
@ -583,14 +583,14 @@ class LdapConnection implements Selectable
/** /**
* Run the given LDAP query and return the resulting entries * Run the given LDAP query and return the resulting entries
* *
* @param Query $query The query to fetch results with * @param LdapQuery $query The query to fetch results with
* @param array $fields Request these attributes instead of the ones registered in the given query * @param array $fields Request these attributes instead of the ones registered in the given query
* *
* @return array * @return array
* *
* @throws LdapException In case an error occured while fetching the results * @throws LdapException In case an error occured while fetching the results
*/ */
protected function runQuery(Query $query, array $fields = null) protected function runQuery(LdapQuery $query, array $fields = null)
{ {
$limit = $query->getLimit(); $limit = $query->getLimit();
$offset = $query->hasOffset() ? $query->getOffset() - 1 : 0; $offset = $query->hasOffset() ? $query->getOffset() - 1 : 0;
@ -663,15 +663,15 @@ class LdapConnection implements Selectable
* *
* This utilizes paged search requests as defined in RFC 2696. * This utilizes paged search requests as defined in RFC 2696.
* *
* @param Query $query The query to fetch results with * @param LdapQuery $query The query to fetch results with
* @param array $fields Request these attributes instead of the ones registered in the given query * @param array $fields Request these attributes instead of the ones registered in the given query
* @param int $pageSize The maximum page size, defaults to self::PAGE_SIZE * @param int $pageSize The maximum page size, defaults to self::PAGE_SIZE
* *
* @return array * @return array
* *
* @throws LdapException In case an error occured while fetching the results * @throws LdapException In case an error occured while fetching the results
*/ */
protected function runPagedQuery(Query $query, array $fields = null, $pageSize = null) protected function runPagedQuery(LdapQuery $query, array $fields = null, $pageSize = null)
{ {
if ($pageSize === null) { if ($pageSize === null) {
$pageSize = static::PAGE_SIZE; $pageSize = static::PAGE_SIZE;

View File

@ -10,7 +10,7 @@ use Icinga\Exception\NotImplementedError;
/** /**
* LDAP query class * LDAP query class
*/ */
class Query extends SimpleQuery class LdapQuery extends SimpleQuery
{ {
/** /**
* This query's filters * This query's filters