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

Package: PEAR2\Net\RouterOS

Represents a RouterOS request.

Parent(s)
\PEAR2\Net\RouterOS\Message
Author
Vasil Rangelov  
Category
Net  
License
LGPL License 2.1  
Link
http://netrouteros.sourceforge.net/  

Properties

Propertyprivatestring  $_command= ''

The command to be executed.
Details
Type
string
Propertyprivate\PEAR2\Net\RouterOS\Query  $_query= 'null'

A query for the command.
Default valuenullDetails
Type
\PEAR2\Net\RouterOS\Query
Propertyprotectedarray  $arguments= 'array('
inherited

An array with message arguments. Keys are the names of the arguments, array values are values for the corresponding argument.Inherited from: \PEAR2\Net\RouterOS\Message::$arguments
Default valuearray(Details
Type
array
Inherited_from
\PEAR2\Net\RouterOS\Message::$arguments  

Methods

methodpublic__construct( string $command ) : void

Creates a request to send to RouterOS.

Parameters
Name Type Description
$command string

The command to send.

Details
See
\PEAR2\Net\RouterOS\setCommand()  
See
\PEAR2\Net\RouterOS\setArgument()  
See
\PEAR2\Net\RouterOS\setTag()  
methodpublicgetAllArguments( ) : array
inherited

Gets all arguments in an array.

Inherited from: \PEAR2\Net\RouterOS\Message::getAllArguments()
Returns
Type Description
array An array with the keys as argument names, and the array values as argument values.
Details
See
\PEAR2\Net\RouterOS\getArgument()  
See
\PEAR2\Net\RouterOS\setArgument()  
methodpublicgetArgument( string $name ) : string|resource
inherited

Gets the value of an argument.

Inherited from: \PEAR2\Net\RouterOS\Message::getArgument()
Parameters
Name Type Description
$name string

The name of the argument.

Returns
Type Description
string|resource The value of the specified argument. Returns NULL if such an argument is not set.
Details
See
\PEAR2\Net\RouterOS\setArgument()  
methodpublicgetCommand( ) : string

Gets the command that will be send to RouterOS.

Gets the command that will be send to RouterOS in its API syntax.

Returns
Type Description
string The command to send.
Details
See
\PEAR2\Net\RouterOS\setCommand()  
methodpublicgetQuery( ) : \PEAR2\Net\RouterOS\Query

Gets the currently associated query

Returns
Type Description
\PEAR2\Net\RouterOS\Query The currently associated query.
Details
See
\PEAR2\Net\RouterOS\setQuery()  
methodpublicgetTag( ) : string
inherited

Gets the tag that the message is associated with.

Inherited from: \PEAR2\Net\RouterOS\Message::getTag()
Returns
Type Description
string The current tag or NULL if there isn't a tag.
Details
See
\PEAR2\Net\RouterOS\setTag()  
methodpublicremoveAllArguments( ) : \PEAR2\Net\RouterOS\Request

Removes all arguments from the request.

Returns
Type Description
\PEAR2\Net\RouterOS\Request The request object.
methodpublicsanitizeArgumentName( mixed $name ) : string
staticinherited

Sanitizes a name of an argument (message or query one).

Inherited from: \PEAR2\Net\RouterOS\Message::sanitizeArgumentName()
Parameters
Name Type Description
$name mixed

The name to sanitize.

Returns
Type Description
string The sanitized name.
methodpublicsanitizeArgumentValue( mixed $value ) : string
staticinherited

Sanitizes a value of an argument (message or query one).

Inherited from: \PEAR2\Net\RouterOS\Message::sanitizeArgumentValue()
Parameters
Name Type Description
$value mixed

The value to sanitize.

Returns
Type Description
string The sanitized value.
methodpublicsend( \PEAR2\Net\RouterOS\Communicator $com ) : int

Sends a request over a communicator.

Parameters
Name Type Description
$com \PEAR2\Net\RouterOS\Communicator

The communicator to send the request over.

Returns
Type Description
int The number of bytes sent.
Details
See
\PEAR2\Net\RouterOS\Client::sendSync()  
See
\PEAR2\Net\RouterOS\Client::sendAsync()  
methodpublicsetArgument( string $name, string $value = null ) : \PEAR2\Net\RouterOS\Request

Sets an argument for the request.

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

Returns
Type Description
\PEAR2\Net\RouterOS\Request The request object.
Details
See
\PEAR2\Net\RouterOS\getArgument()  
methodpublicsetCommand( string $command ) : \PEAR2\Net\RouterOS\Request

Sets the command to send to RouterOS.

Sets the command to send to RouterOS. The command can use the API or CLI syntax of RouterOS, but either way, it must be absolute (begin with a "/") and without arguments.

Parameters
Name Type Description
$command string

The command to send.

Returns
Type Description
\PEAR2\Net\RouterOS\Request The request object.
Details
See
\PEAR2\Net\RouterOS\getCommand()  
See
\PEAR2\Net\RouterOS\setArgument()  
methodpublicsetQuery( \PEAR2\Net\RouterOS\Query $query = null ) : \PEAR2\Net\RouterOS\Request

Sets the query to send with the command.

Parameters
Name Type Description
$query \PEAR2\Net\RouterOS\Query

The query to be set. Setting NULL will remove the currently associated query.

Returns
Type Description
\PEAR2\Net\RouterOS\Request The request object.
Details
See
\PEAR2\Net\RouterOS\getQuery()  
methodpublicsetTag( string $tag ) : \PEAR2\Net\RouterOS\Request

Sets the tag to associate the request with.

Sets the tag to associate the request with. Setting NULL erases the currently set tag.

Parameters
Name Type Description
$tag string

The tag to set.

Returns
Type Description
\PEAR2\Net\RouterOS\Request The request object.
Details
See
\PEAR2\Net\RouterOS\getTag()  
Documentation was generated by DocBlox 0.14.1.