\ResponseCollection.php
RouterOS API client implementation.
This package allows you to read and write information from a RouterOS host using MikroTik's RouterOS API.
PHP version 5
- Author
- Vasil Rangelov
- Category
- Net
- Copyright
- 2011 Vasil Rangelov
- License
- LGPL License 2.1
- Link
- http://netrouteros.sourceforge.net/
- Package
- PEAR2_Net_RouterOS
- Version
- 1.0.0b1
\PEAR2\Net\RouterOS\ResponseCollection
Represents a collection of RouterOS responses.
- Implements
- Author
- Vasil Rangelov
- Category
- Net
- License
- LGPL License 2.1
- Link
- http://netrouteros.sourceforge.net/
Properties

array
$argumentMap= 'null'
nullDetails- Type
- array

array
$responseTags= 'array('
array(Details- Type
- array

array
$responseTypes= 'array('
array(Details- Type
- array
Methods

__call(
string $method, array $args
)
:
mixedCalls a method of the response pointed by the pointer.
Calls a method of the response pointed by the pointer. This is a magic PHP method, thanks to which any function you call on the collection that is not defined will be redirected to the response.
| 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
)
:
voidCreates a new collection.
| Name | Type | Description |
|---|---|---|
| $responses | array | An array of responses, in network order. |

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

current(
)
:
\PEAR2\Net\RouterOS\ResponseGets 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. |

getAllOfType(
string $type
)
:
\PEAR2\Net\RouterOS\ResponseCollectionGets 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\ResponseCollectionGets 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(
)
:
arrayGets all distinct argument names.
Gets all distinct argument names across all responses.
| 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\ResponseGets the last {@link Response} in the collection.
| Type | Description |
|---|---|
| \PEAR2\Net\RouterOS\Response | The last response in the collection. |

key(
)
:
intGets 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\ResponseMoves 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
)
:
boolChecks 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\ResponseGets 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
)
:
voidN/A
This method exists only because it is required for ArrayAccess. The collection is read only.
| Name | Type | Description |
|---|---|---|
| $offset | int | N/A |
| $value | \PEAR2\Net\RouterOS\Response | N/A |

offsetUnset(
int $offset
)
:
voidN/A
This method exists only because it is required for ArrayAccess. The collection is read only.
| Name | Type | Description |
|---|---|---|
| $offset | int | N/A |

rewind(
)
:
\PEAR2\Net\RouterOS\ResponseResets 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\ResponseMoves 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(
)
:
arrayGets the whole collection as an array.
| Type | Description |
|---|---|
| array | An array with all responses, in network order. |