Request.php
- Author
- Vasil Rangelov
- Category
- Net
- Copyright
- 2011 Vasil Rangelov
- License
- LGPL License 2.1
- Link
- http://pear2.php.net/PEAR2_Net_RouterOS
- Package
- PEAR2_Net_RouterOS
- Version
- 1.0.0b4
\PEAR2\Net\RouterOS\Request
- Parent(s)
- \PEAR2\Net\RouterOS\Message
- Author
- Vasil Rangelov
- Category
- Net
- License
- LGPL License 2.1
- Link
- http://pear2.php.net/PEAR2_Net_RouterOS
Properties
Methods


__construct(string $command, \PEAR2\Net\RouterOS\Query $query = null, string $tag = null) : void
Creates a request to send to RouterOS.
Name | Type | Description |
---|---|---|
$command | string | The command to send. Can also contain arguments expressed in a shell-like syntax. |
$query | \PEAR2\Net\RouterOS\Query | A query to associate with the request. |
$tag | string | The tag for the request. |


__invoke(mixed $arg = null) : mixed
A shorthand gateway.
Name | Type | Description |
---|---|---|
$arg | mixed | A {@link Query} to associate the request with, a {@link Communicator} to send the request over, an argument to get the value of, or NULL to get all arguments as an array. If a second argument is provided, this becomes the name of the argument to set the value of, and the second argument is the value to set. |
Type | Description |
---|---|
mixed | Whatever the long form function would have returned. |


_send(\PEAR2\Net\RouterOS\Communicator $com) : int
Sends a request over a communicator.
Name | Type | Description |
---|---|---|
$com | \PEAR2\Net\RouterOS\Communicator | The communicator to send the request over. |
Type | Description |
---|---|
int | The number of bytes sent. |


getQuery() : \PEAR2\Net\RouterOS\Query
Gets the currently associated query
Type | Description |
---|---|
\PEAR2\Net\RouterOS\Query | The currently associated query. |


parseArgumentString(string $string) : void
Parses the arguments of a command.
Name | Type | Description |
---|---|---|
$string | string | The argument string to parse. |


removeAllArguments() : \PEAR2\Net\RouterOS\Request | \PEAR2\Net\RouterOS\Request
Removes all arguments from the request.
Type | Description |
---|---|
\PEAR2\Net\RouterOS\Request | \PEAR2\Net\RouterOS\Request | The request object. |
- Fluent
- This method is part of a fluent interface and will return the same instance


send(\PEAR2\Net\RouterOS\Communicator $com, \PEAR2\Net\RouterOS\Registry $reg = null) : int
Sends a request over a communicator.
Name | Type | Description |
---|---|---|
$com | \PEAR2\Net\RouterOS\Communicator | The communicator to send the request over. |
$reg | \PEAR2\Net\RouterOS\Registry | An optional registry to sync the request with. |
Type | Description |
---|---|
int | The number of bytes sent. |


setArgument(string $name, string $value = '') : \PEAR2\Net\RouterOS\Request | \PEAR2\Net\RouterOS\Request
Sets an argument for the request.
Name | Type | Description |
---|---|---|
$name | string | Name of the argument. |
$value | string | Value of the argument. Setting the value to NULL removes an argument of this name. |
Type | Description |
---|---|
\PEAR2\Net\RouterOS\Request | \PEAR2\Net\RouterOS\Request | The request object. |


setCommand(string $command) : \PEAR2\Net\RouterOS\Request | \PEAR2\Net\RouterOS\Request
Sets the command to send to RouterOS.
Name | Type | Description |
---|---|---|
$command | string | The command to send. |
Type | Description |
---|---|
\PEAR2\Net\RouterOS\Request | \PEAR2\Net\RouterOS\Request | The request object. |


setQuery(\PEAR2\Net\RouterOS\Query $query = null) : \PEAR2\Net\RouterOS\Request | \PEAR2\Net\RouterOS\Request
Sets the query to send with the command.
Name | Type | Description |
---|---|---|
$query | \PEAR2\Net\RouterOS\Query | The query to be set. Setting NULL will remove the currently associated query. |
Type | Description |
---|---|
\PEAR2\Net\RouterOS\Request | \PEAR2\Net\RouterOS\Request | The request object. |


setTag(string $tag) : \PEAR2\Net\RouterOS\Request | \PEAR2\Net\RouterOS\Request
Sets the tag to associate the request with.
Name | Type | Description |
---|---|---|
$tag | string | The tag to set. |
Type | Description |
---|---|
\PEAR2\Net\RouterOS\Request | \PEAR2\Net\RouterOS\Request | The request object. |