示例#1
0
 /**
  * Read entity files and merge them into one array
  *
  * @param string $entityName
  * @param string $scope
  * @return array
  */
 public function read($entityName, $scope = 'etc')
 {
     $result = [];
     $files = $this->fileResolver->get($entityName . '.xml', $scope);
     foreach ($files as $file) {
         $presetXml = simplexml_load_string($file);
         if ($presetXml instanceof \SimpleXMLElement) {
             $array = $this->xmlConverter->convert($presetXml);
             if (is_array($array)) {
                 $result = array_replace($result, $array);
             }
         }
     }
     return $result;
 }
示例#2
0
文件: Page.php 项目: Mohitsahu123/mtf
 /**
  * Generate Pages XML
  * @return void
  */
 public function generateXml()
 {
     $this->cnt = 0;
     $pages = $this->fileResolver->get('page.xml', 'etc');
     foreach ($pages as $page) {
         $configXml = simplexml_load_string($page);
         if ($configXml instanceof \SimpleXMLElement) {
             $config = $this->xmlConverter->convert($configXml);
             $modulePath = $config['module'];
             unset($config['module']);
             foreach ($config as $class => $pageItem) {
                 $pageItem['module_path'] = $modulePath;
                 $pageItem['class'] = $class;
                 $this->generatePageXml($pageItem);
             }
         }
     }
     \Mtf\Util\Generate\GenerateResult::addResult('Page XML Files', $this->cnt);
 }