Пример #1
0
 private static function writeConfiguration($oDoc, &$aConfig, $oElement)
 {
     foreach ($aConfig as $sKey => &$mValue) {
         if (is_array($mValue)) {
             $oInner = null;
             if ($oElement->tagName === 'datasources') {
                 $oInner = $oDoc->createElement('datasource');
                 $oInner->setAttribute('id', $sKey);
             } else {
                 $oInner = $oDoc->createElement($sKey);
             }
             $oElement->appendChild($oInner);
             self::writeConfiguration($oDoc, $mValue, $oInner);
         } else {
             if (is_bool($mValue)) {
                 $mValue = BooleanParser::stringForBoolean($mValue);
             }
             $oAttr = $oDoc->createElement($sKey);
             $oAttr->appendChild($oDoc->createTextNode((string) $mValue));
             $oElement->appendChild($oAttr);
         }
     }
 }