mirror of
https://github.com/torrentpier/torrentpier-lts.git
synced 2025-03-01 15:21:02 +03:00
49 lines
1.3 KiB
PHP
49 lines
1.3 KiB
PHP
<?php
|
|
/**
|
|
* Zend Framework (http://framework.zend.com/)
|
|
*
|
|
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
|
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
|
* @license http://framework.zend.com/license/new-bsd New BSD License
|
|
*/
|
|
|
|
namespace Zend\XmlRpc\Value;
|
|
|
|
class Struct extends AbstractCollection
|
|
{
|
|
/**
|
|
* Set the value of a struct native type
|
|
*
|
|
* @param array $value
|
|
*/
|
|
public function __construct($value)
|
|
{
|
|
$this->type = self::XMLRPC_TYPE_STRUCT;
|
|
parent::__construct($value);
|
|
}
|
|
|
|
/**
|
|
* Generate the XML code that represent struct native MXL-RPC value
|
|
*
|
|
* @return void
|
|
*/
|
|
protected function _generateXML()
|
|
{
|
|
$generator = $this->getGenerator();
|
|
$generator->openElement('value')
|
|
->openElement('struct');
|
|
|
|
if (is_array($this->value)) {
|
|
foreach ($this->value as $name => $val) {
|
|
$generator->openElement('member')
|
|
->openElement('name', $name)
|
|
->closeElement('name');
|
|
$val->generateXml();
|
|
$generator->closeElement('member');
|
|
}
|
|
}
|
|
$generator->closeElement('struct')
|
|
->closeElement('value');
|
|
}
|
|
}
|