PEAR2_Net_RouterOS
1.0.0b6
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 () | |
Counts the responses 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 responses. More... | |
Protected Attributes | |
$responses = array() | |
$responseTypes = array() | |
$responseTags = array() | |
$responsesIndex = array() | |
$propertyMap = null | |
$position = 0 | |
$index = null | |
$compareBy = array() | |
Definition at line 61 of file ResponseCollection.php.
__construct | ( | array | $responses | ) |
Creates a new collection.
Response[] | $responses An array of responses, in network order. |
Definition at line 146 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 531 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 iterator. |
Definition at line 175 of file ResponseCollection.php.
Compares two responses.
Compares two responses, based on criteria defined in static::$compareBy.
Response | $itemA | The response to compare. |
Response | $itemB | The response to compare $a against. |
Definition at line 552 of file ResponseCollection.php.
count | ( | ) |
Counts the responses in the collection.
Definition at line 250 of file ResponseCollection.php.
current | ( | ) |
Gets the response at the current pointer position.
Definition at line 374 of file ResponseCollection.php.
end | ( | ) |
Moves the pointer to the last valid position, and returns the last response.
Definition at line 398 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 462 of file ResponseCollection.php.
getAllTagged | ( | $tag | ) |
Gets all responses with a specified tag.
string | $tag | The tag to filter by. |
Definition at line 479 of file ResponseCollection.php.
getIndex | ( | ) |
Gets the name of the property used as an index.
Definition at line 218 of file ResponseCollection.php.
getPropertyMap | ( | ) |
Gets all distinct property names.
Gets all distinct property names across all responses.
Definition at line 435 of file ResponseCollection.php.
key | ( | ) |
Gets the key at the current pointer position.
Definition at line 411 of file ResponseCollection.php.
next | ( | ) |
Moves the pointer forward by 1, and gets the next response.
Definition at line 362 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 264 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 279 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 |
(PHPMD.UnusedFormalParameter)
Definition at line 301 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 |
(PHPMD.UnusedFormalParameter)
Definition at line 318 of file ResponseCollection.php.
orderBy | ( | array | $criteria | ) |
Order resones by criteria.
string[]|array<string,null|int|array<int|callable>> | $criteria The criteria to order responses 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 greater 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 511 of file ResponseCollection.php.
prev | ( | ) |
Moves the pointer backwards by 1, and gets the previous response.
Definition at line 385 of file ResponseCollection.php.
rewind | ( | ) |
Resets the pointer to 0, and returns the first response.
Definition at line 329 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 344 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 occurs multiple times within the collection, only the last matching response will be accessible by that value. |
Definition at line 195 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 231 of file ResponseCollection.php.
valid | ( | ) |
Checks if the pointer is still pointing to an existing offset.
Definition at line 421 of file ResponseCollection.php.