Esempio n. 1
0
 /**
  * Performs route matching & dispatch and sends the response.
  *
  * @return $this
  */
 public function run()
 {
     // Route
     $match = $this->router->match($this->request->getPathInfo(), $this->request->getMethod(), $this->request->getHttpHost(false));
     // Dispatch
     $this->dispatch($match);
     // Respond
     $this->response->send();
 }
Esempio n. 2
0
 /**
  * @covers Smrtr\HaltoRouter::match
  * @covers Smrtr\HaltoRouter::compileRoute
  */
 public function testMatchWithHostGroup()
 {
     $this->router->addHostnames(array('www.example.com', 'public.example.com'), 'example website');
     $this->router->map('GET', '/foo/bar', 'Misc@foobar', null, 'example website');
     $this->assertFalse($this->router->match('/foo/bar', 'GET', 'private.example.com'));
     $this->assertSame(array('target' => 'Misc@foobar', 'params' => array(), 'name' => null), $this->router->match('/foo/bar', 'GET', 'public.example.com'));
 }