@@ -32,6 +32,22 @@ abstract class AbstractController implements PluginManagerAwareInterface
3232 /** @var callable */
3333 protected $ next ;
3434
35+ /**
36+ * Transform an "action" token into a method name
37+ *
38+ * @param string $action
39+ * @return string
40+ */
41+ public static function getMethodFromAction ($ action )
42+ {
43+ $ method = str_replace (['. ' , '- ' , '_ ' ], ' ' , $ action );
44+ $ method = ucwords ($ method );
45+ $ method = str_replace (' ' , '' , $ method );
46+ $ method = lcfirst ($ method );
47+ $ method .= 'Action ' ;
48+ return $ method ;
49+ }
50+
3551 /**
3652 * @param ServerRequestInterface $request
3753 * @param ResponseInterface $response
@@ -48,9 +64,10 @@ public function __invoke(
4864 $ this ->next = $ next ;
4965
5066 return $ this ->dispatch ();
51-
5267 }
5368
69+ abstract public function dispatch ();
70+
5471 /**
5572 * @return ServerRequestInterface
5673 */
@@ -75,8 +92,6 @@ public function getNext()
7592 return $ this ->next ;
7693 }
7794
78- public abstract function dispatch ();
79-
8095 /**
8196 * Method overloading: return/call plugins
8297 *
@@ -125,22 +140,4 @@ public function setPluginManager(PluginManager $pluginManager)
125140 $ this ->pluginManager = $ pluginManager ;
126141 return $ this ;
127142 }
128-
129- /**
130- * Transform an "action" token into a method name
131- *
132- * @param string $action
133- * @return string
134- */
135- public static function getMethodFromAction ($ action )
136- {
137- $ method = str_replace (['. ' , '- ' , '_ ' ], ' ' , $ action );
138- $ method = ucwords ($ method );
139- $ method = str_replace (' ' , '' , $ method );
140- $ method = lcfirst ($ method );
141- $ method .= 'Action ' ;
142- return $ method ;
143- }
144-
145-
146- }
143+ }
0 commit comments