예제 #1
0
 /**
  *
  */
 function execute()
 {
     if (!is_callable($register_callable = array($this, 'register')) || !method_exists($this, 'register')) {
         $error_msg = sprintf('Generator class %s does not have a callable register() method.', get_class($this));
         Util::log_error($error_msg);
     }
     /**
      * Call the Generator->register()
      */
     call_user_func($register_callable);
     if (count($dirs = $this->dirs)) {
         /**
          * Make any subdirectories
          */
         foreach ($dirs as $dir) {
             Util::mkdir($dir);
         }
     }
     if (count($files = $this->output_files)) {
         foreach ($files as $template_type => $file_template) {
             $this->generate_file($file_template, $template_type);
         }
     }
     if (count($generators = $this->generators)) {
         foreach ($generators as $generator_slug => $generator) {
             $value = $this->get_object_value(Util::underscorify($generator_slug));
             self::generate($value, $generator);
         }
     }
 }