コード例 #1
0
ファイル: Console.class.php プロジェクト: natalikom/miao
 /**
  * Копия класса
  * @param string $newClassName
  * @param string $newFilePath
  * @return bool|int
  * @throws Miao_Console_Exception_ClassExists
  * @throws Miao_Console_Exception_ClassNotFound
  */
 protected function _cpClass($newClassName, $newFilePath)
 {
     if (!file_exists($this->_filePath)) {
         throw new Miao_Console_Exception_ClassNotFound('Class "' . $this->_className . '" not found! ' . $this->_filePath);
     }
     if (file_exists($newFilePath)) {
         throw new Miao_Console_Exception_ClassExists('Class ' . $newClassName . ' exists! Enter new name.');
     }
     $oldTemplatePath = $this->_getTemplatePath($this->_className);
     if (file_exists($oldTemplatePath)) {
         $newTemplatePath = $this->_getTemplatePath($newClassName);
         $content = $this->_getUpdatedContent($oldTemplatePath, $this->_className, $newClassName);
         $this->_log('Copy template: ' . $newTemplatePath, Miao_Log::DEBUG);
         Miao_Console_Helper::mkFile($newTemplatePath, $content);
     }
     $content = $this->_getUpdatedContent($this->_filePath, $this->_className, $newClassName);
     $status = Miao_Console_Helper::mkFile($newFilePath, $content);
     $this->_log('Create class: ' . $newFilePath, $status ? Miao_Log::DEBUG : Miao_Log::WARN);
     return $status;
 }
コード例 #2
0
ファイル: Console.class.Test.php プロジェクト: theratg/miao
 protected function _createFolders(array $list)
 {
     foreach ($list as $className) {
         try {
             $path = Miao_Path::getDefaultInstance()->getFilenameByClassName($className);
             Miao_Console_Helper::mkFile($path, $className);
         } catch (Exception $ex) {
         }
     }
 }