\ResponseCollection.php

Show: inherited

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

Package: PEAR2\Net\RouterOS

Represents a collection of RouterOS responses.

Implements
Author
Vasil Rangelov  
Category
Net  
License
LGPL License 2.1  
Link
http://netrouteros.sourceforge.net/  

Properties

Propertyprotectedarray  $argumentMap= 'null'

An array with all distinct arguments across all {@link Response} objects. Created at the first call of {@link getArgumentMap()}.
Default valuenullDetails
Type
array
Propertyprotectedint  $position= '0'

A pointer, as required by SeekableIterator.
Default value0Details
Type
int
Propertyprotectedarray  $responseTags= 'array('

An array with each {@link Response} object's tag.
Default valuearray(Details
Type
array
Propertyprotectedarray  $responseTypes= 'array('

An array with each {@link Response} object's type.
Default valuearray(Details
Type
array
Propertyprotectedarray  $responses= 'array('

An array with all {@link Response} objects.
Default valuearray(Details
Type
array

Methods

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

Parameters
Name Type Description
$method string

The name of the method to call.

$args array

The arguments to pass to the method.

Returns
Type Description
mixed Whatever the called function returns.
methodpublic__construct( array $responses ) : void

Creates a new collection.

Parameters
Name Type Description
$responses array

An array of responses, in network order.

methodpubliccount( ) : int

Counts the responses in the collection.

Returns
Type Description
int The number of responses in the collection.
methodpubliccurrent( ) : \PEAR2\Net\RouterOS\Response

Gets the response at the current pointer position.

Returns
Type Description
\PEAR2\Net\RouterOS\Response The response at the current pointer position, or FALSE if the position is not valid.
methodpublicgetAllOfType( string $type ) : \PEAR2\Net\RouterOS\ResponseCollection

Gets all responses of a specified type.

Parameters
Name Type Description
$type string

The response type to filter by. Valid values are the Response::TYPE_* constants.

Returns
Type Description
\PEAR2\Net\RouterOS\ResponseCollection A new collection with responses of the specified type.
methodpublicgetAllTagged( string $tag ) : \PEAR2\Net\RouterOS\ResponseCollection

Gets all responses with a specified tag.

Parameters
Name Type Description
$tag string

The tag to filter by.

Returns
Type Description
\PEAR2\Net\RouterOS\ResponseCollection A new collection with responses having the specified tag.
methodpublicgetArgumentMap( ) : array

Gets all distinct argument names.

Gets all distinct argument names across all responses.

Returns
Type Description
array An array with all distinct argument names as keys, and the indexes at which they occur as values.
methodpublicgetLast( ) : \PEAR2\Net\RouterOS\Response

Gets the last {@link Response} in the collection.

Returns
Type Description
\PEAR2\Net\RouterOS\Response The last response in the collection.
methodpublickey( ) : int

Gets the key at the current pointer position.

Returns
Type Description
int The key at the current pointer position, i.e. the pointer position itself, or FALSE if the position is not valid.
methodpublicnext( ) : \PEAR2\Net\RouterOS\Response

Moves the pointer forward by 1, and gets the next response.

Returns
Type Description
\PEAR2\Net\RouterOS\Response The next {@link Response} object, or FALSE if the position is not valid.
methodpublicoffsetExists( int $offset ) : bool

Checks if an offset exists.

Parameters
Name Type Description
$offset int

The offset to check.

Returns
Type Description
bool TRUE if the offset exists, FALSE otherwise.
methodpublicoffsetGet( int $offset ) : \PEAR2\Net\RouterOS\Response

Gets a {@link Response} from a specified offset.

Parameters
Name Type Description
$offset int

The offset of the desired response.

Returns
Type Description
\PEAR2\Net\RouterOS\Response The response at the specified offset.
methodpublicoffsetSet( 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.

Parameters
Name Type Description
$offset int

N/A

$value \PEAR2\Net\RouterOS\Response

N/A

methodpublicoffsetUnset( int $offset ) : void

N/A

This method exists only because it is required for ArrayAccess. The collection is read only.

Parameters
Name Type Description
$offset int

N/A

methodpublicrewind( ) : \PEAR2\Net\RouterOS\Response

Resets the pointer to 0, and returns the first response.

Returns
Type Description
\PEAR2\Net\RouterOS\Response The first response in the collection, or FALSE if the collection is empty.
methodpublicseek( int $position ) : \PEAR2\Net\RouterOS\Response

Moves the position pointer to a specified position.

Parameters
Name Type Description
$position int

The position to move to.

Returns
Type Description
\PEAR2\Net\RouterOS\Response The {@link Response} at the specified position, or FALSE if the specified position is not valid.
methodpublictoArray( ) : array

Gets the whole collection as an array.

Returns
Type Description
array An array with all responses, in network order.
methodpublicvalid( ) : bool

Checks if the pointer is still pointing to an existing offset.

Returns
Type Description
bool TRUE if the pointer is valid, FALSE otherwise.
Documentation was generated by DocBlox 0.14.1.