Пример #1
0
 /**
  * Takes an array and converts it to an xml child element of the given
  * child node.
  *
  * @param array $params
  * @param SimpleXml $child
  */
 public function formatRequestXml($params, $child)
 {
     foreach ($params as $key => $value) {
         if (is_array($value)) {
             switch ($key) {
                 case 'attributes':
                     foreach ($value as $l => $b) {
                         if (is_bool($b)) {
                             $b = $b === true ? 'TRUE' : 'FALSE';
                         }
                         $child->addAttribute($l, $b);
                     }
                     break;
                 default:
                     $childNode = $child->addChild($key);
                     self::formatRequestXml($value, $childNode);
             }
         } elseif (!is_numeric($key)) {
             $child->addChild($key, $value);
         } else {
             $child[0] = $value;
         }
     }
 }