This repository has been archived by the owner on Nov 11, 2020. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #118 from doctrine/doc-cleanup
[WIP] Documentation cleanup
- Loading branch information
Showing
30 changed files
with
1,798 additions
and
623 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,91 +22,149 @@ | |
use ArrayAccess; | ||
|
||
/** | ||
* ArrayIterator | ||
* ArrayIterator is used to encapsulate document results from commands. | ||
* | ||
* @license http://www.opensource.org/licenses/mit-license.php MIT | ||
* @since 1.0 | ||
* @author Jonathan H. Wage <[email protected]> | ||
* @since 1.0 | ||
* @author Jonathan H. Wage <[email protected]> | ||
*/ | ||
class ArrayIterator implements Iterator, ArrayAccess | ||
{ | ||
/** | ||
* @var array | ||
*/ | ||
private $elements; | ||
|
||
/** | ||
* Constructor. | ||
* | ||
* @param array $elements | ||
*/ | ||
public function __construct(array $elements = array()) | ||
{ | ||
$this->elements = $elements; | ||
} | ||
|
||
/** | ||
* Return the first element in the array, or false if the array is empty. | ||
* | ||
* @see http://php.net/manual/en/function.reset.php | ||
* @return array|object|boolean | ||
*/ | ||
public function first() | ||
{ | ||
return reset($this->elements); | ||
} | ||
|
||
/** | ||
* Return the last element in the array, or false if the array is empty. | ||
* | ||
* @see http://php.net/manual/en/function.end.php | ||
* @return array|object|boolean | ||
*/ | ||
public function last() | ||
{ | ||
return end($this->elements); | ||
} | ||
|
||
/** | ||
* @see http://php.net/manual/en/iterator.key.php | ||
*/ | ||
public function key() | ||
{ | ||
return key($this->elements); | ||
} | ||
|
||
/** | ||
* @see http://php.net/manual/en/iterator.next.php | ||
*/ | ||
public function next() | ||
{ | ||
next($this->elements); | ||
} | ||
|
||
/** | ||
* @see http://php.net/manual/en/iterator.current.php | ||
*/ | ||
public function current() | ||
{ | ||
return current($this->elements); | ||
} | ||
|
||
/** | ||
* @see http://php.net/manual/en/countable.count.php | ||
*/ | ||
public function count() | ||
{ | ||
return count($this->elements); | ||
} | ||
|
||
/** | ||
* @see http://php.net/manual/en/iterator.rewind.php | ||
*/ | ||
public function rewind() | ||
{ | ||
reset($this->elements); | ||
} | ||
|
||
/** | ||
* Alias of {@link ArrayIterator::rewind()}. | ||
*/ | ||
public function reset() | ||
{ | ||
reset($this->elements); | ||
} | ||
|
||
/** | ||
* @see http://php.net/manual/en/iterator.valid.php | ||
*/ | ||
public function valid() | ||
{ | ||
return current($this->elements) !== false; | ||
} | ||
|
||
/** | ||
* @see http://php.net/manual/en/arrayaccess.offsetset.php | ||
*/ | ||
public function offsetSet($offset, $value) | ||
{ | ||
$this->elements[$offset] = $value; | ||
} | ||
|
||
/** | ||
* @see http://php.net/manual/en/arrayaccess.offsetexists.php | ||
*/ | ||
public function offsetExists($offset) | ||
{ | ||
return isset($this->elements[$offset]); | ||
} | ||
|
||
/** | ||
* @see http://php.net/manual/en/arrayaccess.offsetunset.php | ||
*/ | ||
public function offsetUnset($offset) | ||
{ | ||
unset($this->elements[$offset]); | ||
} | ||
|
||
/** | ||
* @see http://php.net/manual/en/arrayaccess.offsetget.php | ||
*/ | ||
public function offsetGet($offset) | ||
{ | ||
return isset($this->elements[$offset]) ? $this->elements[$offset] : null; | ||
} | ||
|
||
/** | ||
* @see Iterator::toArray() | ||
*/ | ||
public function toArray() | ||
{ | ||
return $this->elements; | ||
} | ||
|
||
/** | ||
* @see Iterator::getSingleResult() | ||
*/ | ||
public function getSingleResult() | ||
{ | ||
$result = null; | ||
|
@@ -117,4 +175,4 @@ public function getSingleResult() | |
$this->reset(); | ||
return $result ? $result : null; | ||
} | ||
} | ||
} |
Oops, something went wrong.