예제 #1
0
 function process($template)
 {
     $command = $this->_createCommand($template);
     if (!is_a($command, 'WactTemplateCommand')) {
         throw new WactException($this->command . '" must inherite from WactTemplateCommand class');
     }
     $method = WactTemplate::toStudlyCaps('do_' . $this->method_name, false);
     if (!method_exists($command, $method)) {
         throw new WactException('Template command "' . $this->command . '" does not support method: ' . $method);
     }
     return call_user_func_array(array($command, $method), $this->params);
 }
예제 #2
0
 protected function _createFetcher()
 {
     $class_path = new WactClassPath($this->fetcher_name, $this->include_path);
     $fetcher = $class_path->createObject();
     foreach ($this->params as $param => $value) {
         $method = WactTemplate::toStudlyCaps('set_' . $param, false);
         if (in_array($param, $this->reserved_params)) {
             $this->{$method}($value);
         } elseif (method_exists($fetcher, $method)) {
             $fetcher->{$method}($value);
         } else {
             throw new WactException('Fetcher "' . $this->fetcher_name . '" does not support method: ' . $method);
         }
     }
     return $fetcher;
 }
예제 #3
0
 protected function _addParamsToDataset($dataset, $params)
 {
     foreach ($params as $param => $value) {
         $method = WactTemplate::toStudlyCaps('set_' . $param);
         $dataset->{$method}($value);
     }
 }