Exemplo n.º 1
0
 /**
  * Heart of the application.
  * Optimus takes you through application as per url.
  *
  * @throws \LP\Framework\Exceptions\RouteNotFoundException
  * @throws \Lp\Framework\Exceptions\DuplicateFileNameException
  */
 public function letsRoll()
 {
     try {
         $goto = Router::reduce(Request::howYouWantToGo(), Request::whereYouWantToGo());
         $classArray = array();
         if ($controller = StoreKeeper::getFromStore(StoreKeeper::STORE_TYPE_CONTROLLER, $goto['path']['controller'])) {
             $classArray = array($controller, $goto['path']['action']);
         } elseif (empty($classArray)) {
             $classArray = array(new IndexController(), self::DEFAULT_ACTION);
         }
         call_user_func_array($classArray, $goto['params']);
     } catch (RouteNotFoundException $rnfe) {
         var_dump($rnfe);
     } catch (DuplicateFileNameException $dfne) {
         var_dump($dfne);
     } catch (\Exception $e) {
         var_dump($e);
     }
 }
Exemplo n.º 2
0
<?php

use Wbd\Framework\Core\Request\Router;
Router::map("GET", "/", "indexController", "blah");
Router::map("GET", "/store/{id}/", "indexController", "index");
Router::map("GET", "/deal/{id}/", "dealController", "deal");