Пример #1
0
 /**
  * Save value to XML
  *
  * @param ConfigInstance $config
  * @param string         $xpath
  * @param string         $value
  * @return $this
  */
 public function setValueToXml(ConfigInstance $config, $xpath, $value)
 {
     if (null === $value) {
         $nodeValue = $config->xpath($xpath);
         /** @var ConfigInstance $nodeValue */
         $nodeValue = $nodeValue ? $nodeValue[0] : null;
         if ($nodeValue) {
             $this->removeNode($config, $xpath);
         }
     } else {
         $this->getXmlMerger()->merge($config, $this->getXmlUpdate($xpath, $value));
     }
     return $this;
 }