Request.phpView Source

Show: PublicProtectedPrivateinherited
Table of Contents
RouterOS API client implementation.
RouterOS is the flag product of the company MikroTik and is a powerful router software. One of its many abilities is to allow control over it via an API. This package provides a client for that API, in turn allowing you to use PHP to control RouterOS hosts. PHP version 5
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

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://pear2.php.net/PEAR2_Net_RouterOS  

Properties

>VPropertyprivatestring $_command

The command to be executed.

Details
Type
string
>VPropertyprivate\PEAR2\Net\RouterOS\Query $_query

A query for the command.

Methods

methodpublic__construct(string $command, \PEAR2\Net\RouterOS\Query $query = null, string $tag = null) : void

Creates a request to send to RouterOS.

Parameters
NameTypeDescription
$commandstring

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.

$tagstring

The tag for the request.

Details
See
 
See
 
See
 
See
 
methodpublic__invoke(mixed $arg = null) : mixed

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.
Parameters
NameTypeDescription
$argmixed

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.

Returns
TypeDescription
mixedWhatever the long form function would have returned.
methodprivate_send(\PEAR2\Net\RouterOS\Communicator $com) : int

Sends a request over a communicator.

The only difference with the non private equivalent is that this one does not do locking.
Parameters
NameTypeDescription
$com\PEAR2\Net\RouterOS\Communicator

The communicator to send the request over.

Returns
TypeDescription
intThe number of bytes sent.
Details
See
 
See
 
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
TypeDescription
stringThe command to send.
Details
See
 
methodpublicgetQuery() : \PEAR2\Net\RouterOS\Query

Gets the currently associated query

Returns
TypeDescription
\PEAR2\Net\RouterOS\QueryThe currently associated query.
Details
See
 
methodprotectedparseArgumentString(string $string) : void

Parses the arguments of a command.

Parameters
NameTypeDescription
$stringstring

The argument string to parse.

methodpublicremoveAllArguments() : \PEAR2\Net\RouterOS\Request | \PEAR2\Net\RouterOS\Request

Removes all arguments from the request.

Returns
TypeDescription
\PEAR2\Net\RouterOS\Request | \PEAR2\Net\RouterOS\RequestThe request object.
Details
Fluent
This method is part of a fluent interface and will return the same instance  
methodpublicsend(\PEAR2\Net\RouterOS\Communicator $com, \PEAR2\Net\RouterOS\Registry $reg = null) : int

Sends a request over a communicator.

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

Returns
TypeDescription
intThe number of bytes sent.
Details
See
 
See
 
methodpublicsetArgument(string $name, string $value = '') : \PEAR2\Net\RouterOS\Request | \PEAR2\Net\RouterOS\Request

Sets an argument for the request.

Parameters
NameTypeDescription
$namestring

Name of the argument.

$valuestring

Value of the argument. Setting the value to NULL removes an argument of this name.

Returns
TypeDescription
\PEAR2\Net\RouterOS\Request | \PEAR2\Net\RouterOS\RequestThe request object.
Details
Fluent
This method is part of a fluent interface and will return the same instance  
See
 
methodpublicsetCommand(string $command) : \PEAR2\Net\RouterOS\Request | \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
NameTypeDescription
$commandstring

The command to send.

Returns
TypeDescription
\PEAR2\Net\RouterOS\Request | \PEAR2\Net\RouterOS\RequestThe request object.
Details
Fluent
This method is part of a fluent interface and will return the same instance  
See
 
See
 
methodpublicsetQuery(\PEAR2\Net\RouterOS\Query $query = null) : \PEAR2\Net\RouterOS\Request | \PEAR2\Net\RouterOS\Request

Sets the query to send with the command.

Parameters
NameTypeDescription
$query\PEAR2\Net\RouterOS\Query

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

Returns
TypeDescription
\PEAR2\Net\RouterOS\Request | \PEAR2\Net\RouterOS\RequestThe request object.
Details
Fluent
This method is part of a fluent interface and will return the same instance  
See
 
methodpublicsetTag(string $tag) : \PEAR2\Net\RouterOS\Request | \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
NameTypeDescription
$tagstring

The tag to set.

Returns
TypeDescription
\PEAR2\Net\RouterOS\Request | \PEAR2\Net\RouterOS\RequestThe request object.
Details
Fluent
This method is part of a fluent interface and will return the same instance  
See
 
Documentation was generated by phpDocumentor 2.1.0-DEV .