Skip to content

Commit 00c64bc

Browse files
committed
Simplify code
1 parent eca7ccf commit 00c64bc

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/Bridge.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ public static function create(ContainerInterface $container = null): App
3131

3232
$app = AppFactory::create();
3333

34+
$controllerInvoker = self::createControllerInvoker($container);
35+
$app->getRouteCollector()->setDefaultInvocationStrategy($controllerInvoker);
36+
37+
return $app;
38+
}
39+
40+
private static function createControllerInvoker(ContainerInterface $container): ControllerInvoker
41+
{
3442
$resolvers = [
3543
// Inject parameters by name first
3644
new AssociativeArrayResolver(),
@@ -41,8 +49,7 @@ public static function create(ContainerInterface $container = null): App
4149
];
4250

4351
$invoker = new Invoker(new ResolverChain($resolvers), $container);
44-
$app->getRouteCollector()->setDefaultInvocationStrategy(new ControllerInvoker($invoker));
4552

46-
return $app;
53+
return new ControllerInvoker($invoker);
4754
}
4855
}

0 commit comments

Comments
 (0)