コード例 #1
0
ファイル: Config.php プロジェクト: srinathweb/MTool
 /**
  * Set config value
  *
  * @param string $path separated by slash (/)
  * @param string $value
  */
 public function set($path, $value)
 {
     $segments = explode('/', $path);
     $node = $this->_xml;
     foreach ($segments as $_key => $_segment) {
         if (!$node->{$_segment}->getName()) {
             $node->addChild($_segment);
         }
         if ($_key == count($segments) - 1) {
             $node->{$_segment} = $value;
         }
         $node = $node->{$_segment};
     }
     Mtool_Codegen_Filesystem::write($this->_path, $this->asPrettyXML());
 }
コード例 #2
0
ファイル: Template.php プロジェクト: srinathweb/MTool
 /**
  * Move template to $to directory with $as name
  *
  * @param string $to - target directory
  * @param string $as - result filename
  */
 public function move($to, $as)
 {
     $to = Mtool_Codegen_Filesystem::slash($to);
     Mtool_Codegen_Filesystem::mkdir($to);
     Mtool_Codegen_Filesystem::write($to . $as, $this->content());
 }