1 <?php
2
3 /**
4 * Core routing and configuration class
5 *
6 * @author Art <a.molcanovas@gmail.com>
7 */
8 class Router {
9
10 /**
11 * Attempts to route a request
12 *
13 * @author Art <a.molcanovas@gmail.com>
14 */
15 function route() {
16 if(!defined('PHPUNIT_RUNNING')) {
17 $route = trim(strtolower(get(IO::$argv[0])));
18 $file = DIR_CORE . 'routes' . DIRECTORY_SEPARATOR . $route . '.php';
19
20 if(file_exists($file)) {
21 include $file;
22 } else {
23 _echo('The route ' . $route . ' is invalid.');
24 }
25 }
26 }
27
28 /**
29 * Echoes some empty lines before the "press any key to exit" bit
30 *
31 * @author Art <a.molcanovas@gmail.com>
32 */
33 function __destruct() {
34 echo PHP_EOL . PHP_EOL;
35 }
36 }