psr12 fixes for new PHP_CodeSniffer (#4795)
[openemr.git] / interface / super / rules / base / library / ControllerRouter.php
blob1cf3382b2045247be64f3d09bf672599eb85a6d3
1 <?php
3 // Copyright (C) 2010-2011 Aron Racho <aron@mi-squred.com>
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
10 /**
11 * Description of ControllerRouter
13 * @author aron
15 class ControllerRouter
17 /**
18 * xxx todo: error handling
20 function route()
22 $actionParam = _get("action");
23 $paramParts = explode("!", $actionParam);
24 $controller = $paramParts[0];
25 $action = $paramParts[1];
27 $controllerDir = controller_dir($controller);
28 $controllerFile = $controllerDir . "/controller.php";
29 require_once($controllerFile);
30 $controllerClassName = "Controller_$controller";
31 $controllerInstance = new $controllerClassName();
33 $actionRouter = new ActionRouter(
34 $controllerInstance,
35 $action,
36 $controllerDir
39 $actionRouter->route();