예제 #1
0
 /**
  * Constructor
  *
  * @param \YapepBase\Request\IRequest $request           The request instance
  * @param array                       $routes            The list of available routes
  * @param string                      $defaultLanguage   The default language code to use.
  * @param array                       $usableLanguages   Contains the usable languages.
  * @param IReverseRouter              $reverseRouter     The reverse router to use.
  */
 public function __construct(IRequest $request, array $routes, $defaultLanguage, $usableLanguages, IReverseRouter $reverseRouter = null)
 {
     $this->defaultLanguage = $defaultLanguage;
     $this->usableLanguages = $usableLanguages;
     $this->currentLanguage = $this->getCurrentLanguageFromRequest($request, $usableLanguages, $defaultLanguage);
     parent::__construct($request, $routes, empty($reverseRouter) ? new LanguageArrayReverseRouter($routes, $this->currentLanguage, $this->defaultLanguage) : $reverseRouter);
 }
예제 #2
0
 /**
  * Constructor.
  *
  * @param \YapepBase\Request\IRequest      $request         The request instance
  * @param string                           $configName      The name of the configuration where the routes are
  *                                                          stored.
  * @param \YapepBase\Router\IReverseRouter $reverseRouter   The reverse router to use. If not set, it will use
  *                                                          an ArrayReverseRouter.
  *
  * @throws RouterException   On error
  */
 public function __construct(IRequest $request, $configName, IReverseRouter $reverseRouter = null)
 {
     $routes = Config::getInstance()->get('resource.routing.' . $configName, false);
     if (!is_array($routes)) {
         throw new RouterException('No route config found for name: ' . $configName, RouterException::ERR_ROUTE_CONFIG);
     }
     parent::__construct($request, $routes, $reverseRouter);
 }