示例#1
0
文件: Curry.php 项目: no22/gongo
 function invoke($arg = null)
 {
     if ($this->arity <= 0) {
         return Gongo_Fn::call($this->callback);
     }
     $this->arguments[] = $arg;
     if ($this->arity <= count($this->arguments)) {
         return Gongo_Fn::apply($this->callback, $this->arguments);
     }
     return array($this, 'invoke');
 }
示例#2
0
文件: HttpError.php 项目: no22/gongo
 public function render($app, $err, $fnCallback = false)
 {
     $header = isset($this->httpError[$err]) ? $this->httpError[$err] : "HTTP/1.0 {$err}";
     header($header);
     $output = $fnCallback ? Gongo_Fn::call($fnCallback) : null;
     if (is_null($output) && Gongo_App::cfg()) {
         $layout = Gongo_App::cfg()->Error->layout;
         $context = array();
         if ($layout) {
             $context['layout'] = $layout;
         }
         echo $app->render($err, $context, $app->errorTemplate);
     } else {
         $output = $output ? $output : $header;
         echo $output;
     }
     die;
 }