Ejemplo n.º 1
0
 private function M()
 {
     $cls = 'FruitTest\\RouteKit\\Handler';
     if ($this->mux == null) {
         $mux = new Mux();
         $mux->get('/', array($cls, 'get'));
         $mux->post('/', array($cls, 'post'));
         $mux->get('/basic', array($cls, 'basic'));
         $mux->get('/params', array($cls, 'params'));
         $mux->get('/params/:', array($cls, 'params'));
         $mux->get('/params/:/2/:', array($cls, 'params'));
         $mux->get('/params/2/:/:', array($cls, 'params'));
         $mux->get('/init', array($cls, 'constructArgs'), array(1, 2));
         $this->mux = $mux;
     }
     return $this->mux;
 }
Ejemplo n.º 2
0
 private function M()
 {
     $cls = 'FruitTest\\RouteKit\\Handler';
     if (!class_exists('MyRoute')) {
         $mux = new Mux();
         $mux->get('/', array($cls, 'get'));
         $mux->post('/', array($cls, 'post'));
         $mux->get('/basic', array($cls, 'basic'));
         $mux->get('/params', array($cls, 'params'));
         $mux->get('/params/:', array($cls, 'params'));
         $mux->get('/params/:/2/:', array($cls, 'params'));
         $mux->get('/params/2/:/:', array($cls, 'params'));
         $mux->get('/init', array($cls, 'constructArgs'), array(1, 2));
         $mux->get('/min', array($cls, 'constructArgs'), array("a b", "if else switch"));
         $str = $mux->compile('MyRoute');
         eval(substr($str, 5));
     }
     if ($this->mux == null) {
         $this->mux = new \MyRoute();
     }
     return $this->mux;
 }