/** * @param RequestInterface $request * @param Route $route * @return mixed */ public function __invoke(RequestInterface $request, Route $route) { $args = array_filter($route->getMatches(), function ($name) { return strpos($name, '_') !== 0; }, \ARRAY_FILTER_USE_KEY); $route->getEndPoint()->setArgs($args); return $route($request); }
public function testMatches() { $data = ['controller' => 'demo', 'action' => 'index']; $this->route->setMatches($data); self::assertEquals($data, $this->route->getMatches()); }