Guest User

Untitled

a guest
Jan 21st, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. <?php
  2.  
  3. require 'phar://Request.phar/Request/Dispatcher.php';
  4. require 'phar://Request.phar/Request/Context.php';
  5.  
  6. function dispatch(/* $args */) {
  7.  
  8. $args = func_get_args();
  9. array_unshift($args, new Request\Context);
  10.  
  11. //See if there's some cached routes
  12. $routes = apc_fetch('routes');
  13. if (false === $routes) {
  14. require 'phar://Request.phar/Request/Router.php';
  15. $router = new Request\Router;
  16. $routes = $router->getRoutes();
  17. apc_store('routes', $routes);
  18. }
  19.  
  20. //Dispatch to all functions/methods with a @route annotation
  21. $dispatcher = new Request\Dispatcher;
  22. $dispatcher->setRoutes($routes);
  23. $dispatcher->dispatch($args);
  24.  
  25. }
Add Comment
Please, Sign In to add comment