Exemplo n.º 1
0
        if (file_exists(FRAMEWORK . $class . ".php")) {
            include FRAMEWORK . $class . ".php";
        } elseif (file_exists(EXCEPTIONS . $class . ".php")) {
            include EXCEPTIONS . $class . ".php";
        } elseif (file_exists(BASE . $class . ".php")) {
            include BASE . $class . ".php";
        } else {
            throw new FileNotFoundException($class . ".php");
        }
    });
}
function cleanup()
{
    $err = error_get_last();
    if ($err !== null && $err["type"] == E_ERROR) {
        ob_end_clean();
        $response = new ErrorResponse();
        $response->render();
    }
}
if (!DEBUG) {
    register_shutdown_function("cleanup");
}
use Routing\Router;
try {
    header('Content-Type: text/html; charset=utf-8');
    $router = new Router();
    $router->run();
} catch (Exception $e) {
    cleanup();
}