Exemplo n.º 1
0
 public function match(Request $request, $pathOffset = null)
 {
     if (!method_exists($request, 'getUri')) {
         return null;
     }
     $uri = $request->getUri();
     $fullPath = $uri->getPath();
     $path = substr($fullPath, $pathOffset);
     $alias = trim($path, '/');
     $discovery = new DiscoveryRoute($this->defaults);
     $discovery->setUrl($alias);
     $options = $discovery->getRoute();
     $discovery->setGetParams($request);
     $discovery->setMethod($request, $uri);
     return new RouteMatch($options);
 }
Exemplo n.º 2
0
 public static function addDefaultHeaderFiles(\Zend\View\Renderer\RendererInterface $renderer, $default_route, $uri)
 {
     $DiscoveryRoute = new DiscoveryRoute($default_route);
     $DiscoveryRoute->setUrl($uri);
     $routes = $DiscoveryRoute->getRoute();
     $c = explode('\\', $routes['controller']);
     $controller = strtolower(end($c));
     self::$routes['module'] = strtolower($routes['module']);
     self::$routes['controller'] = substr($controller, -10) == 'controller' ? substr($controller, 0, -10) : $controller;
     self::$routes['action'] = strtolower($routes['action']);
     self::$basepath = getcwd() . DIRECTORY_SEPARATOR . 'public';
     self::addJsFile($renderer, DIRECTORY_SEPARATOR . self::$routes['module'] . '.js');
     self::addJsFile($renderer, DIRECTORY_SEPARATOR . self::$routes['module'] . DIRECTORY_SEPARATOR . self::$routes['controller'] . '.js');
     self::addJsFile($renderer, DIRECTORY_SEPARATOR . self::$routes['module'] . DIRECTORY_SEPARATOR . self::$routes['controller'] . DIRECTORY_SEPARATOR . self::$routes['action'] . '.js');
     self::addCssFile($renderer, DIRECTORY_SEPARATOR . self::$routes['module'] . '.css');
     self::addCssFile($renderer, DIRECTORY_SEPARATOR . self::$routes['module'] . DIRECTORY_SEPARATOR . self::$routes['controller'] . '.css');
     self::addCssFile($renderer, DIRECTORY_SEPARATOR . self::$routes['module'] . DIRECTORY_SEPARATOR . self::$routes['controller'] . DIRECTORY_SEPARATOR . self::$routes['action'] . '.css');
 }