\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'
null
Details- Type
- array


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


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


__call(
string $method, array $args
)
:
mixed
Calls 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
)
:
void
Creates a new collection.
Name | Type | Description |
---|---|---|
$responses | array | An array of responses, in network order. |


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. |


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.
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\Response
Gets the last {@link Response} in the collection.
Type | Description |
---|---|
\PEAR2\Net\RouterOS\Response | The last response in the collection. |


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
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
)
:
void
N/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\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. |