예제 #1
0
파일: DefaultRoute.php 프로젝트: borbyu/wrr
 /**
  * Do the routing and call the closure
  *
  * @return \Wrr\Response\AbstractResponse
  */
 public function route()
 {
     if (is_callable($this->function)) {
         $fun = $this->function;
         $this->response->addBodyFragment($fun());
     }
     return $this->response;
 }
예제 #2
0
파일: RestRoute.php 프로젝트: borbyu/wrr
 /**
  * Do the routing and call the closure
  *
  * @return AbstractResponse
  * @throws \Exception
  */
 public function route()
 {
     if (is_callable($this->function)) {
         $fun = $this->function;
         $result = $fun();
         if (is_scalar($result)) {
             $this->response->addBodyFragment($result);
         } elseif (method_exists($this->response, 'setData')) {
             $this->response->setData($result);
         } else {
             throw new \Exception('No Result to Route', 500);
         }
     }
     return $this->response;
 }
예제 #3
0
파일: AdminRoute.php 프로젝트: borbyu/wrr
 /**
  * @return AbstractResponse
  */
 public function route()
 {
     $this->response->addBodyFragment("You are in Admin Land... be careful.");
     return $this->response;
 }