Value
in package
implements
Countable, IteratorAggregate, ArrayAccess
uses
CharsetEncoderAware, DeprecationLogger
This class enables the creation of values for XML-RPC, by encapsulating plain php values.
Table of Contents
Interfaces
- Countable
- IteratorAggregate
- ArrayAccess
Properties
- $_php_class : string|null
- $me : array<string|int, Value>|mixed
- $params : int
- $xmlrpcArray : mixed
- $xmlrpcBase64 : mixed
- $xmlrpcBoolean : mixed
- $xmlrpcDateTime : mixed
- $xmlrpcDouble : mixed
- $xmlrpcI4 : mixed
- $xmlrpcI8 : mixed
- $xmlrpcInt : mixed
- $xmlrpcNull : mixed
- $xmlrpcString : mixed
- $xmlrpcStruct : mixed
- $xmlrpcTypes : mixed
- $xmlrpcValue : mixed
- $_php_class : string|null
- $charsetEncoder : mixed
- $me : array<string|int, Value>|mixed
- $mytype : int
Methods
- __construct() : mixed
- Build an xml-rpc value.
- __get() : mixed
- __isset() : mixed
- __set() : mixed
- __unset() : mixed
- addArray() : int
- Add an array of xml-rpc value objects to an xml-rpc value.
- addScalar() : int
- Add a single php value to an xml-rpc value.
- addStruct() : int
- Merges an array of named xml-rpc value objects into an xml-rpc value.
- arrayMem() : Value
- Returns the n-th member of an xml-rpc value of array type.
- arraySize() : int
- Returns the number of members in an xml-rpc value of array type.
- count() : int
- Returns the number of members in an xml-rpc value: - 0 for uninitialized values - 1 for scalar values - the number of elements for struct and array values
- getCharsetEncoder() : mixed
- kindOf() : string
- Returns a string describing the base type of the value.
- scalarTyp() : string
- Returns the type of the xml-rpc value.
- scalarVal() : mixed
- Returns the value of a scalar xml-rpc value (base 64 decoding is automatically handled here)
- serialize() : string
- Returns the xml representation of the value. XML prologue not included.
- setCharsetEncoder() : void
- structEach() : array<string|int, mixed>
- Return next member element for xml-rpc values of type struct.
- structMem() : Value
- Returns the value of a given struct member (an xml-rpc value object in itself).
- structMemExists() : bool
- Checks whether a struct member with a given name is present.
- structReset() : void
- Reset internal pointer for xml-rpc values of type struct.
- structSize() : int
- Returns the number of members in an xml-rpc value of struct type.
- logDeprecation() : mixed
- logDeprecationUnlessCalledBy() : void
- serializeData() : string
Properties
$_php_class
public
string|null
$_php_class
deprecated - public access left in purely for BC.
$me
public
array<string|int, Value>|mixed
$me
deprecated - public access left in purely for BC. Access via scalarVal()/__construct()
$params
public
int
$params
$mytype - public access left in purely for BC. Access via kindOf()/__construct()
$xmlrpcArray
public
static mixed
$xmlrpcArray
= "array"
$xmlrpcBase64
public
static mixed
$xmlrpcBase64
= "base64"
$xmlrpcBoolean
public
static mixed
$xmlrpcBoolean
= "boolean"
$xmlrpcDateTime
public
static mixed
$xmlrpcDateTime
= "dateTime.iso8601"
$xmlrpcDouble
public
static mixed
$xmlrpcDouble
= "double"
$xmlrpcI4
public
static mixed
$xmlrpcI4
= "i4"
$xmlrpcI8
public
static mixed
$xmlrpcI8
= "i8"
$xmlrpcInt
public
static mixed
$xmlrpcInt
= "int"
$xmlrpcNull
public
static mixed
$xmlrpcNull
= "null"
$xmlrpcString
public
static mixed
$xmlrpcString
= "string"
$xmlrpcStruct
public
static mixed
$xmlrpcStruct
= "struct"
$xmlrpcTypes
public
static mixed
$xmlrpcTypes
= array("i4" => 1, "i8" => 1, "int" => 1, "boolean" => 1, "double" => 1, "string" => 1, "dateTime.iso8601" => 1, "base64" => 1, "array" => 2, "struct" => 3, "null" => 1)
$xmlrpcValue
public
static mixed
$xmlrpcValue
= "undefined"
$_php_class
protected
string|null
$_php_class
= null
$charsetEncoder
protected
static mixed
$charsetEncoder
$me
protected
array<string|int, Value>|mixed
$me
= array()
$mytype
protected
int
$mytype
= 0
0 for undef, 1 for scalar, 2 for array, 3 for struct
Methods
__construct()
Build an xml-rpc value.
public
__construct([array<string|int, Value>|mixed $val = -1 ][, string $type = '' ]) : mixed
When no value or type is passed in, the value is left uninitialized, and the value can be added later.
Parameters
- $val : array<string|int, Value>|mixed = -1
-
if passing in an array, all array elements should be PhpXmlRpc\Value themselves
- $type : string = ''
-
any valid xml-rpc type name (lowercase): i4, int, boolean, string, double, dateTime.iso8601, base64, array, struct, null. If null, 'string' is assumed. You should refer to http://xmlrpc.com/spec.md for more information on what each of these mean.
__get()
public
& __get(mixed $name) : mixed
Parameters
- $name : mixed
__isset()
public
__isset(mixed $name) : mixed
Parameters
- $name : mixed
__set()
public
__set(mixed $name, mixed $value) : mixed
Parameters
- $name : mixed
- $value : mixed
__unset()
public
__unset(mixed $name) : mixed
Parameters
- $name : mixed
addArray()
Add an array of xml-rpc value objects to an xml-rpc value.
public
addArray(array<string|int, Value> $values) : int
If the xml-rpc value is an array, the elements are appended to the existing ones. If the xml-rpc value is empty (uninitialized), this method makes it an array value, and sets that value. Fails otherwise.
Parameters
- $values : array<string|int, Value>
Tags
Return values
int —1 or 0 on failure
addScalar()
Add a single php value to an xml-rpc value.
public
addScalar(mixed $val[, string $type = 'string' ]) : int
If the xml-rpc value is an array, the php value is added as its last element. If the xml-rpc value is empty (uninitialized), this method makes it a scalar value, and sets that value. Fails if the xml-rpc value is not an array (i.e. a struct or a scalar) and already initialized.
Parameters
- $val : mixed
- $type : string = 'string'
-
allowed values: i4, i8, int, boolean, string, double, dateTime.iso8601, base64, null.
Tags
Return values
int —1 or 0 on failure
addStruct()
Merges an array of named xml-rpc value objects into an xml-rpc value.
public
addStruct(array<string|int, Value> $values) : int
If the xml-rpc value is a struct, the elements are merged with the existing ones (overwriting existing ones). If the xml-rpc value is empty (uninitialized), this method makes it a struct value, and sets that value. Fails otherwise.
Parameters
- $values : array<string|int, Value>
Tags
Return values
int —1 or 0 on failure
arrayMem()
Returns the n-th member of an xml-rpc value of array type.
public
arrayMem(int $key) : Value
use array access, e.g. $val[$key]
Parameters
- $key : int
-
the index of the value to be retrieved (zero based)
Return values
ValuearraySize()
Returns the number of members in an xml-rpc value of array type.
public
arraySize() : int
use count() instead
Return values
intcount()
Returns the number of members in an xml-rpc value: - 0 for uninitialized values - 1 for scalar values - the number of elements for struct and array values
public
count() : int
Attributes
- #[ReturnTypeWillChange]
Return values
intgetCharsetEncoder()
public
getCharsetEncoder() : mixed
kindOf()
Returns a string describing the base type of the value.
public
kindOf() : string
Return values
string —either "struct", "array", "scalar" or "undef"
scalarTyp()
Returns the type of the xml-rpc value.
public
scalarTyp() : string
Return values
string —For integers, 'int' is always returned in place of 'i4'. 'i8' is considered a separate type and returned as such
scalarVal()
Returns the value of a scalar xml-rpc value (base 64 decoding is automatically handled here)
public
scalarVal() : mixed
serialize()
Returns the xml representation of the value. XML prologue not included.
public
serialize([string $charsetEncoding = '' ]) : string
Parameters
- $charsetEncoding : string = ''
-
the charset to be used for serialization. If null, US-ASCII is assumed
Return values
stringsetCharsetEncoder()
public
static setCharsetEncoder(mixed $charsetEncoder) : void
Parameters
- $charsetEncoder : mixed
structEach()
Return next member element for xml-rpc values of type struct.
public
structEach() : array<string|int, mixed>
iterate directly over the object using foreach instead
Return values
array<string|int, mixed> —having the same format as PHP's each
method
structMem()
Returns the value of a given struct member (an xml-rpc value object in itself).
public
structMem(string $key) : Value
use array access, e.g. $val[$key]
Will raise a php warning if struct member of given name does not exist.
Parameters
- $key : string
-
the name of the struct member to be looked up
Return values
ValuestructMemExists()
Checks whether a struct member with a given name is present.
public
structMemExists(string $key) : bool
use array access, e.g. isset($val[$key])
Works only on xml-rpc values of type struct.
Parameters
- $key : string
-
the name of the struct member to be looked up
Return values
boolstructReset()
Reset internal pointer for xml-rpc values of type struct.
public
structReset() : void
iterate directly over the object using foreach instead
structSize()
Returns the number of members in an xml-rpc value of struct type.
public
structSize() : int
use count() instead
Return values
intlogDeprecation()
protected
logDeprecation(mixed $message) : mixed
Parameters
- $message : mixed
logDeprecationUnlessCalledBy()
protected
logDeprecationUnlessCalledBy(string $expectedCaller) : void
Parameters
- $expectedCaller : string
-
atm only the method name is supported
serializeData()
protected
serializeData(string $typ, array<string|int, Value>|mixed $val[, string $charsetEncoding = '' ]) : string
this should be folded back into serialize()
Parameters
- $typ : string
- $val : array<string|int, Value>|mixed
- $charsetEncoding : string = ''