File tree 2 files changed +38
-5
lines changed
2 files changed +38
-5
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,13 @@ public static function create(?ContainerInterface $container = null): App
39
39
return $ app ;
40
40
}
41
41
42
- private static function createControllerInvoker (ContainerInterface $ container ): ControllerInvoker
42
+ /**
43
+ * Create an invoker with the default resolvers.
44
+ *
45
+ * @param ContainerInterface $container
46
+ * @return Invoker
47
+ */
48
+ protected static function createInvoker (ContainerInterface $ container ): Invoker
43
49
{
44
50
$ resolvers = [
45
51
// Inject parameters by name first
@@ -50,8 +56,17 @@ private static function createControllerInvoker(ContainerInterface $container):
50
56
new DefaultValueResolver ,
51
57
];
52
58
53
- $ invoker = new Invoker (new ResolverChain ($ resolvers ), $ container );
59
+ return new Invoker (new ResolverChain ($ resolvers ), $ container );
60
+ }
54
61
55
- return new ControllerInvoker ($ invoker );
62
+ /**
63
+ * Create a controller invoker with the default resolvers.
64
+ *
65
+ * @param ContainerInterface $container
66
+ * @return ControllerInvoker
67
+ */
68
+ protected static function createControllerInvoker (ContainerInterface $ container ): ControllerInvoker
69
+ {
70
+ return new ControllerInvoker (self ::createInvoker ($ container ));
56
71
}
57
72
}
Original file line number Diff line number Diff line change @@ -42,10 +42,28 @@ public function __invoke(
42
42
// Inject the attributes defined on the request
43
43
$ parameters += $ request ->getAttributes ();
44
44
45
- return $ this ->invoker ->call ($ callable , $ parameters );
45
+ return $ this ->processResponse ( $ this -> invoker ->call ($ callable , $ parameters) );
46
46
}
47
47
48
- private static function injectRouteArguments (ServerRequestInterface $ request , array $ routeArguments ): ServerRequestInterface
48
+ /**
49
+ * Allow for child classes to process the response.
50
+ *
51
+ * @param ResponseInterface|string The response from the callable.
52
+ * @return ResponseInterface|string The processed response
53
+ */
54
+ protected function processResponse ($ response )
55
+ {
56
+ return $ response ;
57
+ }
58
+
59
+ /**
60
+ * Inject route arguments into the request.
61
+ *
62
+ * @param ServerRequestInterface $request
63
+ * @param array $routeArguments
64
+ * @return ServerRequestInterface
65
+ */
66
+ protected static function injectRouteArguments (ServerRequestInterface $ request , array $ routeArguments ): ServerRequestInterface
49
67
{
50
68
$ requestWithArgs = $ request ;
51
69
foreach ($ routeArguments as $ key => $ value ) {
You can’t perform that action at this time.
0 commit comments