PEAR2_Net_RouterOS
1.0.0b5
A MikroTik RouterOS client
|
Public Member Functions | |
__construct (array $responses) | |
Creates a new collection. More... | |
__invoke ($offset=null) | |
A shorthand gateway. More... | |
setIndex ($name) | |
Sets a property to be usable as a key in the collection. More... | |
getIndex () | |
Gets the name of the property used as an index. More... | |
toArray ($useIndex=false) | |
Gets the whole collection as an array. More... | |
count ($mode=COUNT_NORMAL) | |
Counts the responses/words in the collection. More... | |
offsetExists ($offset) | |
Checks if an offset exists. More... | |
offsetGet ($offset) | |
Gets a Response from a specified offset. More... | |
offsetSet ($offset, $value) | |
N/A. More... | |
offsetUnset ($offset) | |
N/A. More... | |
rewind () | |
Resets the pointer to 0, and returns the first response. More... | |
seek ($position) | |
Moves the position pointer to a specified position. More... | |
next () | |
Moves the pointer forward by 1, and gets the next response. More... | |
current () | |
Gets the response at the current pointer position. More... | |
prev () | |
Moves the pointer backwards by 1, and gets the previous response. More... | |
end () | |
Moves the pointer to the last valid position, and returns the last response. More... | |
key () | |
Gets the key at the current pointer position. More... | |
valid () | |
Checks if the pointer is still pointing to an existing offset. More... | |
getPropertyMap () | |
Gets all distinct property names. More... | |
getAllOfType ($type) | |
Gets all responses of a specified type. More... | |
getAllTagged ($tag) | |
Gets all responses with a specified tag. More... | |
orderBy (array $criteria) | |
Order resones by criteria. More... | |
__call ($method, array $args) | |
Calls a method of the response pointed by the pointer. More... | |
Protected Member Functions | |
compare (Response $itemA, Response $itemB) | |
Compares two respones. More... | |
Protected Attributes | |
$responses = array() | |
$responseTypes = array() | |
$responseTags = array() | |
$responsesIndex = array() | |
$propertyMap = null | |
$position = 0 | |
$index = null | |
$compareBy = array() | |
Definition at line 60 of file ResponseCollection.php.
__construct | ( | array | $responses | ) |
Creates a new collection.
array | $responses | An array of responses, in network order. |
Definition at line 118 of file ResponseCollection.php.
__call | ( | $method, | |
array | $args | ||
) |
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.
string | $method | The name of the method to call. |
array | $args | The arguments to pass to the method. |
Definition at line 510 of file ResponseCollection.php.
__invoke | ( | $offset = null | ) |
A shorthand gateway.
This is a magic PHP method that allows you to call the object as a function. Depending on the argument given, one of the other functions in the class is invoked and its returned value is returned by this function.
int | string | null | $offset | The offset of the response to seek to. If the offset is negative, seek to that relative to the end. If the collection is indexed, you can also supply a value to seek to. Setting NULL will get the current response's interator. |
Definition at line 146 of file ResponseCollection.php.
Compares two respones.
between two respones.
Compares two respones, based on criteria defined in static::$compareBy.
See orderBy() for a detailed description of this array's format.
Definition at line 531 of file ResponseCollection.php.
count | ( | $mode = COUNT_NORMAL | ) |
Counts the responses/words in the collection.
int | $mode | The counter mode. Either COUNT_NORMAL or COUNT_RECURSIVE. When in normal mode, counts the number of responses. When in recursive mode, counts the total number of API words. |
Definition at line 226 of file ResponseCollection.php.
current | ( | ) |
Gets the response at the current pointer position.
Definition at line 356 of file ResponseCollection.php.
end | ( | ) |
Moves the pointer to the last valid position, and returns the last response.
Definition at line 380 of file ResponseCollection.php.
getAllOfType | ( | $type | ) |
Gets all responses of a specified type.
string | $type | The response type to filter by. Valid values are the Response::TYPE_* constants. |
Definition at line 442 of file ResponseCollection.php.
getAllTagged | ( | $tag | ) |
Gets all responses with a specified tag.
string | $tag | The tag to filter by. |
Definition at line 459 of file ResponseCollection.php.
getIndex | ( | ) |
Gets the name of the property used as an index.
Definition at line 189 of file ResponseCollection.php.
getPropertyMap | ( | ) |
Gets all distinct property names.
Gets all distinct property names across all responses.
Definition at line 415 of file ResponseCollection.php.
key | ( | ) |
Gets the key at the current pointer position.
Definition at line 392 of file ResponseCollection.php.
next | ( | ) |
Moves the pointer forward by 1, and gets the next response.
Definition at line 344 of file ResponseCollection.php.
offsetExists | ( | $offset | ) |
Checks if an offset exists.
int | string | $offset | The offset to check. If the collection is indexed, you can also supply a value to check. Note that negative numeric offsets are NOT accepted. |
Definition at line 248 of file ResponseCollection.php.
offsetGet | ( | $offset | ) |
Gets a Response from a specified offset.
int | string | $offset | The offset of the desired response. If the collection is indexed, you can also supply the value to search for. |
Definition at line 263 of file ResponseCollection.php.
offsetSet | ( | $offset, | |
$value | |||
) |
N/A.
This method exists only because it is required for ArrayAccess. The collection is read only.
int | string | $offset | N/A |
Response | $value | N/A |
Definition at line 284 of file ResponseCollection.php.
offsetUnset | ( | $offset | ) |
N/A.
This method exists only because it is required for ArrayAccess. The collection is read only.
int | string | $offset | N/A |
Definition at line 300 of file ResponseCollection.php.
orderBy | ( | array | $criteria | ) |
Order resones by criteria.
mixed[] | $criteria The criteria to order respones by. It takes the form of an array where each key is the name of the property to use as (N+1)th sorting key. The value of each member can be either NULL (for that property, sort normally in ascending order), a single sort order constant (SORT_ASC or SORT_DESC) to sort normally in the specified order, an array where the first member is an order constant, and the second one is sorting flags (same as built in PHP array functions) or a callback. If a callback is provided, it must accept two arguments (the two values to be compared), and return -1, 0 or 1 if the first value is respectively less than, equal to or greather than the second one. Each key of $criteria can also be numeric, in which case the value is the name of the property, and sorting is done normally in ascending order. |
Definition at line 490 of file ResponseCollection.php.
prev | ( | ) |
Moves the pointer backwards by 1, and gets the previous response.
Definition at line 367 of file ResponseCollection.php.
rewind | ( | ) |
Resets the pointer to 0, and returns the first response.
Definition at line 311 of file ResponseCollection.php.
seek | ( | $position | ) |
Moves the position pointer to a specified position.
int | string | $position | The position to move to. If the collection is indexed, you can also supply a value to move the pointer to. A non-existent index will move the pointer to "-1". |
Definition at line 326 of file ResponseCollection.php.
setIndex | ( | $name | ) |
Sets a property to be usable as a key in the collection.
string | null | $name | The name of the property to use. Future calls that accept a position will then also be able to search values of that property for a matching value. Specifying NULL will disable such lookups (as is by default). Note that in case this value occures multiple times within the collection, only the last matching response will be accessible by that value. |
Definition at line 166 of file ResponseCollection.php.
toArray | ( | $useIndex = false | ) |
Gets the whole collection as an array.
bool | $useIndex | Whether to use the index values as keys for the resulting array. |
Definition at line 202 of file ResponseCollection.php.
valid | ( | ) |
Checks if the pointer is still pointing to an existing offset.
Definition at line 402 of file ResponseCollection.php.
|
protected |
Definition at line 111 of file ResponseCollection.php.
|
protected |
Definition at line 104 of file ResponseCollection.php.
|
protected |
Definition at line 99 of file ResponseCollection.php.
|
protected |
Definition at line 94 of file ResponseCollection.php.
|
protected |
Definition at line 66 of file ResponseCollection.php.
|
protected |
Definition at line 87 of file ResponseCollection.php.
|
protected |
Definition at line 76 of file ResponseCollection.php.
|
protected |
Definition at line 71 of file ResponseCollection.php.