PEAR2_Net_RouterOS  1.0.0b6
A MikroTik RouterOS client
Query Class Reference

Public Member Functions

 not ()
 Negates the query. More...
 
 orWhere ($name, $value=null, $operator=self::OP_EX)
 Adds a condition as an alternative to the query. More...
 
 andWhere ($name, $value=null, $operator=self::OP_EX)
 Adds a condition in addition to the query. More...
 
 send (Communicator $com)
 Sends the query over a communicator. More...
 
 verify (Communicator $com)
 Verifies the query. More...
 

Static Public Member Functions

static where ( $name, $value=null, $operator=self::OP_EX)
 Creates a new query with an initial condition. More...
 

Data Fields

const OP_EX = ''
 Checks if the property exists.
 
const OP_NEX = '-'
 Checks if the property does not exist.
 
const OP_EQ = '='
 Checks if the property equals a certain value.
 
const OP_LT = '<'
 Checks if the property is less than a certain value.
 
const OP_GT = '>'
 Checks if the property is greater than a certain value.
 

Protected Member Functions

 __construct ()
 This class is not to be instantiated normally, but by static methods instead. More...
 
 addWhere ($name, $value, $operator)
 Adds a condition. More...
 

Static Protected Member Functions

static sanitizeOperator ($operator)
 Sanitizes the operator of a condition. More...
 

Protected Attributes

 $words = array()
 

Detailed Description

Definition at line 38 of file Query.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( )
protected

This class is not to be instantiated normally, but by static methods instead.

Use static::where() to create an instance of it.

Definition at line 81 of file Query.php.

Member Function Documentation

◆ addWhere()

addWhere (   $name,
  $value,
  $operator 
)
protected

Adds a condition.

Parameters
string$nameThe name of the property to test.
string | resource | null$valueValue of the property as a string or seekable stream. Not required for existence tests. If a seekable stream is provided, it is sent from its current position to its end, and the pointer is seeked back to its current position after sending. Non seekable streams, as well as all other types, are casted to a string.
string$operatorOne of the ACTION_* constants. Describes the operation to perform.
Returns
$this The query object.

Definition at line 296 of file Query.php.

◆ andWhere()

andWhere (   $name,
  $value = null,
  $operator = self::OP_EX 
)

Adds a condition in addition to the query.

Parameters
string$nameThe name of the property to test.
string | resource | null$valueValue of the property as a string or seekable stream. Not required for existence tests. If a seekable stream is provided, it is sent from its current position to its end, and the pointer is seeked back to its current position after sending. Non seekable streams, as well as all other types, are casted to a string.
string$operatorOne of the OP_* constants. Describes the operation to perform.
Returns
$this The query object.

Definition at line 187 of file Query.php.

◆ not()

not ( )

Negates the query.

Returns
$this The query object.

Definition at line 143 of file Query.php.

◆ orWhere()

orWhere (   $name,
  $value = null,
  $operator = self::OP_EX 
)

Adds a condition as an alternative to the query.

Parameters
string$nameThe name of the property to test.
string | resource | null$valueValue of the property as a string or seekable stream. Not required for existence tests. If a seekable stream is provided, it is sent from its current position to its end, and the pointer is seeked back to its current position after sending. Non seekable streams, as well as all other types, are casted to a string.
string$operatorOne of the OP_* constants. Describes the operation to perform.
Returns
$this The query object.

Definition at line 165 of file Query.php.

◆ sanitizeOperator()

static sanitizeOperator (   $operator)
staticprotected

Sanitizes the operator of a condition.

Parameters
string$operatorThe operator to sanitize.
Returns
string The sanitized operator.

Definition at line 93 of file Query.php.

◆ send()

send ( Communicator  $com)

Sends the query over a communicator.

Parameters
Communicator$comThe communicator to send the query over.
Returns
int The number of bytes sent.

Definition at line 200 of file Query.php.

◆ verify()

verify ( Communicator  $com)

Verifies the query.

Verifies the query against a communicator, i.e. whether the query could successfully be sent (assuming the connection is still opened).

Parameters
Communicator$comThe Communicator to check against.
Returns
$this The query object itself.
Exceptions
LengthExceptionIf the resulting length of an API word is not supported.

Definition at line 260 of file Query.php.

◆ where()

static where (   $name,
  $value = null,
  $operator = self::OP_EX 
)
static

Creates a new query with an initial condition.

Parameters
string$nameThe name of the property to test.
string | resource | null$valueValue of the property as a string or seekable stream. Not required for existence tests. If a seekable stream is provided, it is sent from its current position to its end, and the pointer is seeked back to its current position after sending. Non seekable streams, as well as all other types, are casted to a string.
string$operatorOne of the OP_* constants. Describes the operation to perform.
Returns
static A new query object.

Definition at line 129 of file Query.php.


The documentation for this class was generated from the following file: