示例#1
0
文件: rt.php 项目: nmtitov/routiny
 public function __call($name, $arguments) {
     if (RtHelper::checkHTTPMethod($name)) {
         if (isset($arguments[0])) {
             return $this->store($name, $arguments[0]);
         }
     } elseif (RtHelper::checkDecorator($name)) {
         if (isset($arguments[0])) {
             return $this->decorate($name, $arguments[0]);
         } else {
             return $this->decorate($name);
         }
     }
 }
示例#2
0
 /**
  * Run provided function with its arguments and return derived result
  * 
  * @return mixed
  */
 public function perform() {
     if (RtHelper::check_closure($this->function)) {
         if ($this->args) {
             $result = call_user_func_array(
                     array($this->function, '__invoke'), $this->args);
         } else {
             $function = $this->function;
             $result = $function();
         }
     } else if (RtHelper::check_array($this->function)
             || RtHelper::check_string($this->function)) {
         if ($this->args) {
             $result = call_user_func_array($this->function, $this->args);
         } else {
             $result = call_user_func($this->function);
         }
     }
     return $result;
 }
示例#3
0
文件: rt.php 项目: nmtitov/routiny
 public function getType() {
     if (isset($this->request['route'])) {
         $route = $this->request['route'];
         if (is_string($route) && !empty($route)) {
             if (preg_match("/\.(.*)$/i", $route, $type)) {
                 if (is_array($type) && isset($type[0])) {
                     $found_type = strtolower(str_replace('.', '', $type[0]));
                     if (RtHelper::checkType($found_type)) {
                         return $found_type;
                     }
                 }
             }
         }
     }
 }