Commit a787ee7a authored by Fabien Potencier's avatar Fabien Potencier

made a small optimization

parent 15b725ce
......@@ -302,20 +302,19 @@ class Application extends \Pimple implements HttpKernelInterface, EventSubscribe
*/
public function mount($prefix, $app)
{
$prefix = rtrim($prefix, '/');
$mountHandler = function (Request $request, $prefix) use ($app) {
if (is_callable($app)) {
$app = $app();
}
foreach ($app['controllers']->all() as $controller) {
$controller->getRoute()->setPattern(rtrim($prefix, '/').$controller->getRoute()->getPattern());
$controller->getRoute()->setPattern($prefix.$controller->getRoute()->getPattern());
}
return $app->handle($request);
};
$prefix = rtrim($prefix, '/');
$this
->match($prefix.'/{path}', $mountHandler)
->assert('path', '.*')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment