public function testSuffix() { $routeMatch = new RoutingResult(true, array()); $resolver = new TemplatePathResolver(); $resolver->setSuffix('.unkown'); $routeMatch->setMatchedRouteName('/test'); $this->assertSame('/test.unkown', $resolver->resolve($routeMatch)); }
/** * @return string */ public function resolve(RoutingResult $routingResult) { $name = $routingResult->getMatchedRouteName(); if (strpos(strrev($name), '/') === 0) { return $name . 'index' . $this->suffix; } else { return $name . $this->suffix; } }
protected function callAction(RoutingResult $routingResult, callable $action) { $params = $routingResult->getParams(); return $params ? call_user_func_array($action, $params) : call_user_func($action, $routingResult); }
/** * @param Request $request * @param Response $response * @param RoutingResult $routingResult * @param mixed $action * @throws \UnexpectedValueException * @return Response */ protected function callAction(RoutingResult $routingResult, $action) { if (is_callable($action)) { $params = $routingResult->getParams(); $actionReturn = $params ? call_user_func_array($action, $params) : call_user_func($action, $routingResult); } else { throw new \UnexpectedValueException('Unknown Action type'); } return $actionReturn; }