Пример #1
0
 /**
  * Handle image requests
  * 
  * @param Request 			$request
  * @return Response|false
  */
 public function handle(Request $request)
 {
     $this->method = $request->method();
     $this->parseRequestUri($request->uri());
     // GET = image render / info
     if ($this->method === 'GET') {
         return $this->handleGetRequest($request);
     } elseif ($this->method === 'POST') {
         return $this->handlePostRequest($request);
     } elseif ($this->method === 'DELETE') {
         return $this->handleDeleteRequest($request);
     }
 }
 /**
  * Dispatch the application using the super globals
  * 
  * @return Resposne
  */
 public function dispatchFromSuperGlobals()
 {
     return $this->dispatch(Request::fromGlobals());
 }
 /**
  * Test Request::server
  */
 public function testServer()
 {
     $request = new Request('GET', '/', array(), array(), array(), array(), array('name' => 'John'));
     $this->assertEquals('John', $request->server('name'));
     // test default
     $request = new Request('GET', '/', array(), array(), array(), array(), array('name' => 'John'));
     $this->assertEquals('Oliver', $request->server('lastname', 'Oliver'));
 }