Esempio n. 1
0
 /**
  * Take the array of arguments given
  * @param   array   $args
  */
 public function __construct($args)
 {
     $this->_tpl = new Mad_View_Base();
     $this->_tpl->addPath('vendor/Mad/Script/templates');
     $filename = array_shift($args);
     $action = !empty($args) ? array_shift($args) : null;
     $this->_args = $args;
     // generate model stubs
     if (strtolower($action) == 'model') {
         $this->_generateModelStubs();
         // generate migration stubs
     } elseif (strtolower($action) == 'migration') {
         $name = !empty($this->_args) ? array_shift($this->_args) : null;
         $migration = Mad_Support_Inflector::underscore($name);
         $this->_generateMigrationStub($migration);
         // generate controller stubs
     } elseif (strtolower($action) == 'controller') {
         $this->_generateControllerStubs();
         // generate helper stubs
     } elseif (strtolower($action) == 'helper') {
         $this->_generateHelperStubs();
     } elseif (strtolower($action) == 'mailer') {
         $this->_generateMailerStubs();
         // invalid option - show help page
     } else {
         $this->_displayHelp();
     }
 }
Esempio n. 2
0
 /**
  * Constructor.
  *
  * @var  Mad_View_Base  $view
  */
 public function __construct($view = null, $extractor = null)
 {
     if ($view === null) {
         $view = new Mad_View_Base();
         $view->addPath(dirname(__FILE__), $relative = false);
     }
     $this->_view = $view;
     if ($extractor === null) {
         $extractor = new Mad_Controller_Rescue_SourceExtractor();
     }
     $this->_extractor = $extractor;
 }