Пример #1
0
 /**
  * Recursive iteration over array
  *
  * @param string $name name of the current leave
  * @param array  $data value of the current leave
  *
  * @return void
  */
 public function iterateArray($name, $data)
 {
     if (\Genesis\Utils\Common::isValidXMLName($name)) {
         $this->context->startElement($name);
     }
     foreach ($data as $key => $value) {
         if (is_null($value)) {
             continue;
         }
         // Note: XMLWriter discards Attribute writes if they are written
         // after an Element, so make sure the attributes are at the top
         if ($key === '@attributes') {
             $this->writeAttribute($value);
             continue;
         }
         if ($key === '@cdata') {
             $this->writeCData($value);
             continue;
         }
         if ($key === '@value') {
             $this->writeText($value);
             continue;
         }
         $this->writeElement($key, $value);
     }
     if (\Genesis\Utils\Common::isValidXMLName($name)) {
         $this->context->endElement();
     }
 }