Moodle PHP Documentation 4.1
Moodle 4.1.11 (Build: 20240610) (c8c84b4af18)
PhpXmlRpc\Value Class Reference
Inheritance diagram for PhpXmlRpc\Value:

Public Member Functions

 __construct ($val=-1, $type='')
 Build an xmlrpc value.
 
 addArray ($values)
 Add an array of xmlrpc value objects to an xmlrpc value.
 
 addScalar ($val, $type='string')
 Add a single php value to an xmlrpc value.
 
 addStruct ($values)
 Merges an array of named xmlrpc value objects into an xmlrpc value.
 
 arraymem ($key)
 Returns the m-th member of an xmlrpc value of array type.
 
 arraysize ()
 Returns the number of members in an xmlrpc value of array type.
 
 count ()
 Returns the number of members in an xmlrpc value:
 
 getCharsetEncoder ()
 
 getIterator ()
 Implements the IteratorAggregate interface.
 
 getLogger ()
 
 kindOf ()
 Returns a string containing either "struct", "array", "scalar" or "undef", describing the base type of the value.
 
 offsetExists ($offset)
 
 offsetGet ($offset)
 
 offsetSet ($offset, $value)
 
 offsetUnset ($offset)
 
 scalartyp ()
 Returns the type of the xmlrpc value.
 
 scalarval ()
 Returns the value of a scalar xmlrpc value (base 64 decoding is automatically handled here)
 
 serialize ($charsetEncoding='')
 Returns the xml representation of the value.
 
 setCharsetEncoder ($charsetEncoder)
 
 structeach ()
 Return next member element for xmlrpc values of type struct.
 
 structmem ($key)
 Returns the value of a given struct member (an xmlrpc value object in itself).
 
 structmemexists ($key)
 Checks whether a struct member with a given name is present.
 
 structreset ()
 Reset internal pointer for xmlrpc values of type struct.
 
 structsize ()
 Returns the number of members in an xmlrpc value of struct type.
 

Static Public Member Functions

static setLogger ($logger)
 

Public Attributes

string null $_php_class = null
 $_php_class
 
Value[] mixed $me = array()
 
int $mytype = 0
 $mytype
 

Static Public Attributes

static $xmlrpcArray = "array"
 
static $xmlrpcBase64 = "base64"
 
static $xmlrpcBoolean = "boolean"
 
static $xmlrpcDateTime = "dateTime.iso8601"
 
static $xmlrpcDouble = "double"
 
static $xmlrpcI4 = "i4"
 
static $xmlrpcI8 = "i8"
 
static $xmlrpcInt = "int"
 
static $xmlrpcNull = "null"
 
static $xmlrpcString = "string"
 
static $xmlrpcStruct = "struct"
 
static $xmlrpcTypes
 
static $xmlrpcValue = "undefined"
 

Protected Member Functions

 serializedata ($typ, $val, $charsetEncoding='')
 

Static Protected Attributes

static $charsetEncoder
 
static $logger
 

Constructor & Destructor Documentation

◆ __construct()

PhpXmlRpc\Value::__construct ( $val = -1,
$type = '' )

Build an xmlrpc value.

When no value or type is passed in, the value is left uninitialized, and the value can be added later.

Parameters
Value[] | mixed$valif passing in an array, all array elements should be PhpXmlRpc\Value themselves
string$typeany valid xmlrpc type name (lowercase): i4, int, boolean, string, double, dateTime.iso8601, base64, array, struct, null. If null, 'string' is assumed. You should refer to http://www.xmlrpc.com/spec for more information on what each of these mean.

Member Function Documentation

◆ addArray()

PhpXmlRpc\Value::addArray ( $values)

Add an array of xmlrpc value objects to an xmlrpc value.

If the xmlrpc value is an array, the elements are appended to the existing ones. If the xmlrpc value is empty (uninitialized), this method makes it an array value, and sets that value. Fails otherwise.

Parameters
Value[]$values
Return values
int1 or 0 on failure
Todo
add some checking for $values to be an array of xmlrpc values?

◆ addScalar()

PhpXmlRpc\Value::addScalar ( $val,
$type = 'string' )

Add a single php value to an xmlrpc value.

If the xmlrpc value is an array, the php value is added as its last element. If the xmlrpc value is empty (uninitialized), this method makes it a scalar value, and sets that value. Fails if the xmlrpc value is not an array and already initialized.

Parameters
mixed$val
string$typeallowed values: i4, i8, int, boolean, string, double, dateTime.iso8601, base64, null.
Return values
int1 or 0 on failure

◆ addStruct()

PhpXmlRpc\Value::addStruct ( $values)

Merges an array of named xmlrpc value objects into an xmlrpc value.

If the xmlrpc value is a struct, the elements are merged with the existing ones (overwriting existing ones). If the xmlrpc value is empty (uninitialized), this method makes it a struct value, and sets that value. Fails otherwise.

Parameters
Value[]$values
Return values
int1 or 0 on failure
Todo
add some checking for $values to be an array?

◆ arraymem()

PhpXmlRpc\Value::arraymem ( $key)

Returns the m-th member of an xmlrpc value of array type.

Parameters
integer$keythe index of the value to be retrieved (zero based)
Return values
Value
Deprecated
use array access, e.g. $val[$key]

◆ arraysize()

PhpXmlRpc\Value::arraysize ( )

Returns the number of members in an xmlrpc value of array type.

Return values
integer
Deprecated
use count() instead

◆ count()

PhpXmlRpc\Value::count ( )

Returns the number of members in an xmlrpc value:

  • 0 for uninitialized values
  • 1 for scalar values
  • the number of elements for struct and array values
Return values
integer

◆ getIterator()

PhpXmlRpc\Value::getIterator ( )

Implements the IteratorAggregate interface.

Return values
ArrayIterator

◆ kindOf()

PhpXmlRpc\Value::kindOf ( )

Returns a string containing either "struct", "array", "scalar" or "undef", describing the base type of the value.

Return values
string

◆ scalartyp()

PhpXmlRpc\Value::scalartyp ( )

Returns the type of the xmlrpc value.

For integers, 'int' is always returned in place of 'i4'. 'i8' is considered a separate type and returned as such

Return values
string

◆ scalarval()

PhpXmlRpc\Value::scalarval ( )

Returns the value of a scalar xmlrpc value (base 64 decoding is automatically handled here)

Return values
mixed

◆ serialize()

PhpXmlRpc\Value::serialize ( $charsetEncoding = '')

Returns the xml representation of the value.

XML prologue not included.

Parameters
string$charsetEncodingthe charset to be used for serialization. if null, US-ASCII is assumed
Return values
string

◆ serializedata()

PhpXmlRpc\Value::serializedata ( $typ,
$val,
$charsetEncoding = '' )
protected
Parameters
string$typ
Value[] | mixed$val
string$charsetEncoding
Return values
string

◆ structeach()

PhpXmlRpc\Value::structeach ( )

Return next member element for xmlrpc values of type struct.

Return values
Value
Exceptions
Errorstarting with php 8.0, this function should not be used, as it will always throw
Deprecated
iterate directly over the object using foreach instead

◆ structmem()

PhpXmlRpc\Value::structmem ( $key)

Returns the value of a given struct member (an xmlrpc value object in itself).

Will raise a php warning if struct member of given name does not exist.

Parameters
string$keythe name of the struct member to be looked up
Return values
Value
Deprecated
use array access, e.g. $val[$key]

◆ structmemexists()

PhpXmlRpc\Value::structmemexists ( $key)

Checks whether a struct member with a given name is present.

Works only on xmlrpc values of type struct.

Parameters
string$keythe name of the struct member to be looked up
Return values
boolean
Deprecated
use array access, e.g. isset($val[$key])

◆ structreset()

PhpXmlRpc\Value::structreset ( )

Reset internal pointer for xmlrpc values of type struct.

Deprecated
iterate directly over the object using foreach instead

◆ structsize()

PhpXmlRpc\Value::structsize ( )

Returns the number of members in an xmlrpc value of struct type.

Return values
integer
Deprecated
use count() instead

Member Data Documentation

◆ $me

Value [] mixed PhpXmlRpc\Value::$me = array()
Todo
: do these need to be public?

◆ $xmlrpcTypes

PhpXmlRpc\Value::$xmlrpcTypes
static
Initial value:
"i4" => 1,
"i8" => 1,
"int" => 1,
"boolean" => 1,
"double" => 1,
"string" => 1,
"dateTime.iso8601" => 1,
"base64" => 1,
"array" => 2,
"struct" => 3,
"null" => 1,
)
('')  

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