1234567891011121314151617181920212223242526 |
- <?php
- class RouteFactory {
- public static function getInstance() {
- return new RouteFactory();
- }
- private function __construct() {
- }
- public function create(Url $url) {
- switch($url->getPathElement(0)) {
- case "dashboard":
- return DashboardRoute::getInstance();
- case "profile":
- return ProfileRoute::getInstance();
- case "login":
- return LoginRoute::getInstance();
- case "logout":
- return LogoutRoute::getInstance();
- case "install":
- return InstallRoute::getInstance();
- case "":
- return HomeRoute::getInstance();
- default:
- return new DefaultRoute();
- }
- }
- }
|