Ejemplo n.º 1
0
 private function searchForInclude(&$arrayYaml = null)
 {
     if (empty($arrayYaml)) {
         $arrayYaml = $this->yamlarh->getArrayToReturn();
     }
     $includeYaml = null;
     foreach ($arrayYaml as $key => $value) {
         if (is_array($value) && $key !== $this->yamlarh->getParamaterKey() . $this->nodeName && count($value) > 0) {
             $includeYaml[$key] = $this->searchForInclude($value);
             continue;
         }
         if ($key !== $this->yamlarh->getParamaterKey() . $this->nodeName) {
             $includeYaml[$key] = $value;
             continue;
         }
         if (!is_array($value)) {
             $value = array($value);
         }
         $includeYaml = array();
         foreach ($value as $includeFile) {
             $currentFile = new File($this->yamlarh->getFilename());
             $includeFile = new File($includeFile);
             if (!$includeFile->isFile()) {
                 $includeFile->setFolder($currentFile->getFolder() . $includeFile->getFolder());
             }
             $yamlArh = $this->getNewYamlarh($includeFile->absolute());
             $includeYaml = array_merge($yamlArh->parse(), $arrayYaml, $includeYaml);
         }
         unset($includeYaml[$this->yamlarh->getParamaterKey() . $this->nodeName]);
     }
     return $includeYaml;
 }
Ejemplo n.º 2
0
 private function loadFromFile($filename)
 {
     $currentFile = new File($this->yamlarh->getFilename());
     $file = new File($filename);
     if (!$file->isFile()) {
         $file->setFolder($currentFile->getFolder() . $file->getFolder());
     }
     if (!$file->isFile()) {
         throw new SphringException("Property file '%s' cannot be found.", $file->getName());
     }
     $properties = FileLoader::loadFile($file);
     if ($properties === null && in_array($file->getExtension(), self::$extIni)) {
         $ini = new \Zend_Config_Ini($file->absolute());
         $properties = $ini->toArray();
     } elseif ($properties === null) {
         return;
     }
     $this->injectInYamlarh($properties);
 }