Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require 'phar://Request.phar/Request/Dispatcher.php';
- require 'phar://Request.phar/Request/Context.php';
- function dispatch(/* $args */) {
- $args = func_get_args();
- array_unshift($args, new Request\Context);
- //See if there's some cached routes
- $routes = apc_fetch('routes');
- if (false === $routes) {
- require 'phar://Request.phar/Request/Router.php';
- $router = new Request\Router;
- $routes = $router->getRoutes();
- apc_store('routes', $routes);
- }
- //Dispatch to all functions/methods with a @route annotation
- $dispatcher = new Request\Dispatcher;
- $dispatcher->setRoutes($routes);
- $dispatcher->dispatch($args);
- }
Add Comment
Please, Sign In to add comment