Source for file Generator.php

Documentation is available at Generator.php

  1. <?php
  2. // vim: foldmethod=marker
  3. /**
  4.  *  Generator.php
  5.  *
  6.  *  @author     Masaki Fujimoto <fujimoto@php.net>
  7.  *  @license    http://www.opensource.org/licenses/bsd-license.php The BSD License
  8.  *  @package    Ethna
  9.  *  @version    $Id: 16797ead37a9a587cc6fad05259390e4e8f55c89 $
  10.  */
  11.  
  12. // {{{ Ethna_Generator
  13. /**
  14.  *  スケルトン生成クラス
  15.  *
  16.  *  @author     Masaki Fujimoto <fujimoto@php.net>
  17.  *  @access     public
  18.  *  @package    Ethna
  19.  */
  20. {
  21.     /**
  22.      *  スケルトンを生成する
  23.      *
  24.      *  @access public
  25.      *  @param  string  $type       生成する対象
  26.      *  @param  string  $app_dir    アプリケーションのディレクトリ
  27.      *                               (nullのときはアプリケーションを特定しない)
  28.      *  @param  mixed   residue     プラグインのgenerate()にそのまま渡す
  29.      *  @static
  30.      */
  31.     public static function generate()
  32.     {
  33.         $arg_list   func_get_args();
  34.         $type       array_shift($arg_list);
  35.         $app_dir    array_shift($arg_list);
  36.  
  37.         if ($app_dir === null{
  38.             $ctl Ethna_Handle::getEthnaController();
  39.         else {
  40.             $ctl Ethna_Handle::getAppController($app_dir);
  41.         }
  42.         if (Ethna::isError($ctl)) {
  43.             return $ctl;
  44.         }
  45.  
  46.         $plugin_manager $ctl->getPlugin();
  47.         if (Ethna::isError($plugin_manager)) {
  48.             return $plugin_manager;
  49.         }
  50.  
  51.         $generator $plugin_manager->getPlugin('Generator'$type);
  52.         if (Ethna::isError($generator)) {
  53.             return $generator;
  54.         }
  55.         
  56.         // 引数はプラグイン依存とする
  57.         $ret call_user_func_array(array($generator'generate')$arg_list);
  58.         return $ret;
  59.     }
  60.  
  61.     /**
  62.      *  スケルトンを削除する
  63.      *
  64.      *  @access public
  65.      *  @param  string  $type       生成する対象
  66.      *  @param  string  $app_dir    アプリケーションのディレクトリ
  67.      *                               (nullのときはアプリケーションを特定しない)
  68.      *  @param  mixed   residue     プラグインのremove()にそのまま渡す
  69.      *  @static
  70.      */
  71.     public static function remove()
  72.     {
  73.         $arg_list   func_get_args();
  74.         $type       array_shift($arg_list);
  75.         $app_dir    array_shift($arg_list);
  76.  
  77.         if ($app_dir === null{
  78.             $ctl Ethna_Handle::getEthnaController();
  79.         else {
  80.             $ctl Ethna_Handle::getAppController($app_dir);
  81.         }
  82.         if (Ethna::isError($ctl)) {
  83.             return $ctl;
  84.         }
  85.  
  86.         $plugin_manager $ctl->getPlugin();
  87.         if (Ethna::isError($plugin_manager)) {
  88.             return $plugin_manager;
  89.         }
  90.  
  91.         $generator $plugin_manager->getPlugin('Generator'$type);
  92.         if (Ethna::isError($generator)) {
  93.             return $generator;
  94.         }
  95.         
  96.         // 引数はプラグイン依存とする
  97.         $ret call_user_func_array(array($generator'remove')$arg_list);
  98.         return $ret;
  99.     }
  100. }
  101. // }}}

Documentation generated on Fri, 11 Nov 2011 03:58:12 +0900 by phpDocumentor 1.4.3