PEAR2_Net_RouterOS  1.0.0b6
A MikroTik RouterOS client
Message Class Reference
+ Inheritance diagram for Message:
+ Collaboration diagram for Message:

Public Member Functions

 __invoke ($name=null)
 A shorthand gateway. More...
 
 getTag ()
 Gets the tag that the message is associated with. More...
 
 getIterator ()
 Gets all arguments in an array. More...
 
 count ()
 Counts the number of attributes. More...
 

Static Public Member Functions

static sanitizeAttributeName ($name)
 Sanitizes a name of an attribute (message or query one). More...
 
static sanitizeAttributeValue ($value)
 Sanitizes a value of an attribute (message or query one). More...
 

Protected Member Functions

 setTag ($tag)
 Sets the tag to associate the request with. More...
 
 getAttribute ($name)
 Gets the value of an attribute. More...
 
 setAttribute ($name, $value='')
 Sets an attribute for the message. More...
 
 removeAllAttributes ()
 Removes all attributes from the message. More...
 

Protected Attributes

 $attributes = array()
 

Detailed Description

Definition at line 48 of file Message.php.

Member Function Documentation

◆ __invoke()

__invoke (   $name = 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.

Parameters
string | null$nameThe name of an attribute to get the value of, or NULL to get the tag.
Returns
string|resource The value of the specified attribute, or the tag if NULL is provided.

Definition at line 81 of file Message.php.

◆ count()

count ( )

Counts the number of attributes.

Returns
int The number of attributes.

Definition at line 194 of file Message.php.

◆ getAttribute()

getAttribute (   $name)
protected

Gets the value of an attribute.

Parameters
string$nameThe name of the attribute.
Returns
string|resource|null The value of the specified attribute. Returns NULL if such an attribute is not set.
See also
setAttribute()

Definition at line 166 of file Message.php.

◆ getIterator()

getIterator ( )

Gets all arguments in an array.

Returns
ArrayObject An ArrayObject with the keys being argument names, and the array values being argument values.
See also
getArgument()
setArgument()

Definition at line 184 of file Message.php.

◆ getTag()

getTag ( )

Gets the tag that the message is associated with.

Returns
string The current tag or NULL if there isn't a tag.
See also
setTag()

Definition at line 133 of file Message.php.

◆ removeAllAttributes()

removeAllAttributes ( )
protected

Removes all attributes from the message.

Returns
$this The message object.

Definition at line 232 of file Message.php.

◆ sanitizeAttributeName()

static sanitizeAttributeName (   $name)
static

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

Parameters
mixed$nameThe name to sanitize.
Returns
string The sanitized name.

Definition at line 96 of file Message.php.

◆ sanitizeAttributeValue()

static sanitizeAttributeValue (   $value)
static

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

Parameters
mixed$valueThe value to sanitize.
Returns
string|resource The sanitized value.

Definition at line 117 of file Message.php.

◆ setAttribute()

setAttribute (   $name,
  $value = '' 
)
protected

Sets an attribute for the message.

Parameters
string$nameName of the attribute.
string | resource | null$valueValue of the attribute as a string or seekable stream. Setting the value to NULL removes an argument of this name. 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.
Returns
$this The message object.
See also
getArgument()

Definition at line 216 of file Message.php.

◆ setTag()

setTag (   $tag)
protected

Sets the tag to associate the request with.

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

Parameters
string$tagThe tag to set.
Returns
$this The message object.
See also
getTag()

Definition at line 150 of file Message.php.


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