/**
  * Remplacement d'une "feuille" par plusieurs tableaux
  * 
  * @param PHPArray   $oSource
  * @param PHPArray[] $aReplacements Un tableau avec en clé les chemins à remplacer et en valeur des sources de configuration
  * @throws \Exception
  */
 public function __construct(PHPArray $oSource, $aReplacements)
 {
     $sUid = $oSource->getUid();
     $oSourceCopy = $oSource;
     foreach ($aReplacements as $sPath => $oDestination) {
         $sUid .= "/" . $sPath . "/" . $oDestination->getUid();
         foreach ($oDestination->getValue() as $sKey => $aSubArray) {
             $oSourceCopy->insertValue($sPath, [$sKey => $aSubArray]);
         }
         $oSourceCopy->delete($sPath);
     }
     self::$_aConf[$sUid] = $oSourceCopy->getValue();
     parent::__construct($sUid, self::$_aConf[$sUid]);
 }
Example #2
0
 /**
  * Yaml imbriqué
  *
  * @param string $sFilePath
  * @param string $sBaseYamlPath
  */
 public function __construct($sFilePath, $sBaseYamlPath = "")
 {
     $aTemplate = (new Yaml($sFilePath))->getValue();
     $this->_sBaseYamlPath = $sBaseYamlPath ? $sBaseYamlPath : dirname($sFilePath) . "/";
     $this->_populateArray($aTemplate);
     parent::__construct("FILLED" . $sFilePath, $aTemplate);
 }