ResponseCollection.php
- Author
- Vasil Rangelov
- Category
- Net
- Copyright
- 2011 Vasil Rangelov
- License
- LGPL License 2.1
- Link
- http://pear2.php.net/PEAR2_Net_RouterOS
- Package
- PEAR2_Net_RouterOS
- Version
- 1.0.0b4
\PEAR2\Net\RouterOS\ResponseCollection
- Implements
- Author
- Vasil Rangelov
- Category
- Net
- License
- LGPL License 2.1
- Link
- http://pear2.php.net/PEAR2_Net_RouterOS
Properties


array $argumentMap = null
An array with all distinct arguments across all {@link Response} objects. Created at the first call of {@link getArgumentMap()}.
null
Details- Type
- array


array $responseTags = array()
An array with each {@link Response} object's tag.
array()
Details- Type
- array


array $responseTypes = array()
An array with each {@link Response} object's type.
array()
Details- Type
- array
Methods


__call(string $method, array $args) : mixed
Calls a method of the response pointed by the pointer.
Name | Type | Description |
---|---|---|
$method | string | The name of the method to call. |
$args | array | The arguments to pass to the method. |
Type | Description |
---|---|
mixed | Whatever the called function returns. |


__construct(array $responses) : void
Creates a new collection.
Name | Type | Description |
---|---|---|
$responses | array | An array of responses, in network order. |


__invoke(int $offset = null) : \PEAR2\Net\RouterOS\Response
A shorthand gateway.
Name | Type | Description |
---|---|---|
$offset | int | The offset of the response to seek to. Setting NULL will seek to the last response. |
Type | Description |
---|---|
\PEAR2\Net\RouterOS\Response | The {@link Response} at the specified index, last reponse if no index is provided or FALSE if the index is invalid or the collection is empty. |


count() : int
Counts the responses in the collection.
Type | Description |
---|---|
int | The number of responses in the collection. |


current() : \PEAR2\Net\RouterOS\Response
Gets the response at the current pointer position.
Type | Description |
---|---|
\PEAR2\Net\RouterOS\Response | The response at the current pointer position, or FALSE if the position is not valid. |


end() : \PEAR2\Net\RouterOS\Response
Moves the pointer to the last valid position, and returns the last response.
Type | Description |
---|---|
\PEAR2\Net\RouterOS\Response | The last response in the collection, or FALSE if the collection is empty. |


getAllOfType(string $type) : \PEAR2\Net\RouterOS\ResponseCollection
Gets all responses of a specified type.
Name | Type | Description |
---|---|---|
$type | string | The response type to filter by. Valid values are the Response::TYPE_* constants. |
Type | Description |
---|---|
\PEAR2\Net\RouterOS\ResponseCollection | A new collection with responses of the specified type. |


getAllTagged(string $tag) : \PEAR2\Net\RouterOS\ResponseCollection
Gets all responses with a specified tag.
Name | Type | Description |
---|---|---|
$tag | string | The tag to filter by. |
Type | Description |
---|---|
\PEAR2\Net\RouterOS\ResponseCollection | A new collection with responses having the specified tag. |


getArgumentMap() : array
Gets all distinct argument names.
Type | Description |
---|---|
array | An array with all distinct argument names as keys, and the indexes at which they occur as values. |


getLast() : \PEAR2\Net\RouterOS\Response
Gets the last {@link Response} in the collection.
Type | Description |
---|---|
\PEAR2\Net\RouterOS\Response | The last response in the collection or FALSE if the collection is empty. |


key() : int
Gets the key at the current pointer position.
Type | Description |
---|---|
int | The key at the current pointer position, i.e. the pointer position itself, or FALSE if the position is not valid. |


next() : \PEAR2\Net\RouterOS\Response
Moves the pointer forward by 1, and gets the next response.
Type | Description |
---|---|
\PEAR2\Net\RouterOS\Response | The next {@link Response} object, or FALSE if the position is not valid. |


offsetExists(int $offset) : bool
Checks if an offset exists.
Name | Type | Description |
---|---|---|
$offset | int | The offset to check. |
Type | Description |
---|---|
bool | TRUE if the offset exists, FALSE otherwise. |


offsetGet(int $offset) : \PEAR2\Net\RouterOS\Response
Gets a {@link Response} from a specified offset.
Name | Type | Description |
---|---|---|
$offset | int | The offset of the desired response. |
Type | Description |
---|---|
\PEAR2\Net\RouterOS\Response | The response at the specified offset. |


offsetSet(int $offset, \PEAR2\Net\RouterOS\Response $value) : void
N/A
Name | Type | Description |
---|---|---|
$offset | int | N/A |
$value | \PEAR2\Net\RouterOS\Response | N/A |


offsetUnset(int $offset) : void
N/A
Name | Type | Description |
---|---|---|
$offset | int | N/A |


prev() : \PEAR2\Net\RouterOS\Response
Moves the pointer backwards by 1, and gets the previous response.
Type | Description |
---|---|
\PEAR2\Net\RouterOS\Response | The next {@link Response} object, or FALSE if the position is not valid. |


rewind() : \PEAR2\Net\RouterOS\Response
Resets the pointer to 0, and returns the first response.
Type | Description |
---|---|
\PEAR2\Net\RouterOS\Response | The first response in the collection, or FALSE if the collection is empty. |


seek(int $position) : \PEAR2\Net\RouterOS\Response
Moves the position pointer to a specified position.
Name | Type | Description |
---|---|---|
$position | int | The position to move to. |
Type | Description |
---|---|
\PEAR2\Net\RouterOS\Response | The {@link Response} at the specified position, or FALSE if the specified position is not valid. |


toArray() : array
Gets the whole collection as an array.
Type | Description |
---|---|
array | An array with all responses, in network order. |