Beispiel #1
0
 protected function _runLibs()
 {
     $xml = $this->_xmlObj;
     $result = array();
     $libsList = self::getLibPathList($xml->libs);
     foreach ($libsList as $libName => $libDir) {
         $configFilenameList = $this->_getConfigFilenameList($libDir, $libName);
         $xmlConfigFilenameList = simplexml_load_string(Converter::array2xml($configFilenameList));
         foreach ($xml->libs->children() as $lib) {
             $subLibName = $lib->getName();
             $filename = $this->_getConfigFilename($libName, $subLibName);
             $config = $this->_getModules($lib);
             if ($config) {
                 $this->_sxmlAppend($config, $xmlConfigFilenameList);
                 $tmp = $this->_generateSlice($libDir . '/data', $config, $filename);
                 if ($subLibName && array_key_exists($subLibName, $result)) {
                     $result[$subLibName] = array_merge($result[$subLibName], $tmp);
                 } else {
                     $result[$subLibName] = $tmp;
                 }
             }
         }
         $result[$libName . '_main'] = $this->_generateSlice($libDir . '/data', $this->_xmlMainConfig, 'config_main');
     }
     return $result;
 }
Beispiel #2
0
 /**
  * @dataProvider providerTestArray2xml
  */
 public function testArray2xml($data, $actual, $exceptionName = '')
 {
     if ($exceptionName) {
         $this->setExpectedException($exceptionName);
     }
     $expected = Converter::array2xml($data);
     $this->assertEquals($expected, $actual);
     //reverse test
     $tmp = Converter::xml2array($expected);
     $expected = Converter::array2xml($tmp);
     $this->assertEquals($expected, $actual);
 }
Beispiel #3
0
 protected function _getXml()
 {
     $result = Converter::array2xml($this->_data);
     return $result;
 }
Beispiel #4
0
 public static function saveToXml($filename, $data)
 {
     $content = Converter::array2xml($data);
     $result = file_put_contents($filename, $content);
     return $result;
 }
Beispiel #5
0
 private function _saveToXml($data, $filename)
 {
     $content = Converter::array2xml($data);
     $result = file_put_contents($filename, $content);
     return $result;
 }