12 namespace fpoirotte\XRL\Types;
26 foreach ($this->value as $key => $val) {
27 $res[$key] = $val->get();
36 throw new \InvalidArgumentException(
'Expected struct value');
39 foreach (
$value as $key => $val) {
40 if (!is_string($key) && !is_int($key)) {
41 throw new \InvalidArgumentException(
'Expected struct value');
44 if (!($val instanceof \fpoirotte\XRL\Types\
AbstractType)) {
45 throw new \InvalidArgumentException(
'Expected a valid XML-RPC type');
53 public function write(\XMLWriter $writer, \DateTimeZone $timezone, $stringTag)
55 $writer->startElement(
'struct');
56 foreach ($this->value as $key => $val) {
57 $writer->startElement(
'member');
58 $writer->startElement(
'name');
59 $writer->text((
string) $key);
60 $writer->endElement();
61 $writer->startElement(
'value');
62 $val->write($writer, $timezone, $stringTag);
63 $writer->endElement();
64 $writer->endElement();
66 $writer->endElement();
70 protected static function parse(
$value, \DateTimeZone $timezone = null)
89 if (!is_string($offset)) {
90 throw new \InvalidArgumentException(
'Expected string offset');
92 $this->value[$offset] =
$value;
106 unset($this->value[$offset]);
118 $keys = array_keys($this->value);
static parse($value,\DateTimeZone $timezone=null)
$index
Current index in the collection.
$value
Current value associated with this object.
offsetSet($offset, $value)
The XML-RPC "struct" type.
A class representing an abstract XML-RPC type.
An abstract XML-RPC type representing a collection of values.
write(\XMLWriter $writer,\DateTimeZone $timezone, $stringTag)