示例#1
0
 /**
  * Run the action of the route
  * @return mixed Returns the result of the action
  */
 public function execute()
 {
     if (isset($this->container['Packfire\\Router\\DispatcherInterface'])) {
         $dispatcher = $this->container['Packfire\\Router\\DispatcherInterface'];
     } else {
         $dispatcher = new Dispatcher();
     }
     if (isset($this->config['action'])) {
         $callback = self::loadCallback($this->container, $this->config['action']);
         $defaults = isset($this->config['defaults']) ? $this->config['defaults'] : array();
         $params = array_merge($defaults, $this->params);
         return $dispatcher->dispatch($callback, $params);
     }
 }
示例#2
0
 public function testDispatch3()
 {
     $dispatcher = new Dispatcher();
     $result = $dispatcher->dispatch(array($this, 'func2'), array('a' => 3));
     $this->assertEquals(5, $result);
 }