コード例 #1
0
 /**
  * @param string $outputFile
  * @return void
  */
 static function generatePhp($outputFile)
 {
     $tpl = new phpMorphy_Generator_Template(__DIR__ . '/GramTab/tpl/php');
     $consts = phpMorphy_Dict_GramTab_ConstStorage_Factory::getAllHelpers();
     $helper = new phpMorphy_Generator_GramTab_HelperPhp();
     $content = $tpl->get('gramtab', array('helper' => $helper, 'all_constants' => $consts));
     @mkdir(dirname($outputFile), 0744, true);
     file_put_contents($outputFile, $content);
 }
コード例 #2
0
 /**
  * @param string $outputDirectory
  * @return void
  */
 static function generate($outputDirectory)
 {
     $storage_ary = array('File', 'Mem', 'Shm');
     $tpl = new phpMorphy_Generator_Template(__DIR__ . '/GramInfo/tpl');
     $helper_class = "phpMorphy_Generator_TemplateHelper_Fsa";
     foreach ($storage_ary as $storage_name) {
         $storage_class = "phpMorphy_Generator_StorageHelper_" . ucfirst($storage_name);
         $helper = new phpMorphy_Generator_GramInfo_Helper($tpl, new $storage_class());
         $result = $tpl->get('graminfo', array('helper' => $helper));
         $file_path = $outputDirectory . DIRECTORY_SEPARATOR . phpMorphy_Loader::classNameToFilePath($helper->getClassName());
         @mkdir(dirname($file_path), 0744, true);
         file_put_contents($file_path, $result);
     }
 }