From 8efaf2a0a77acdd91bc4625739739c0e1b691bd4 Mon Sep 17 00:00:00 2001 From: Alexander Demidov Date: Fri, 25 May 2012 14:18:05 +0400 Subject: [PATCH] Change static to dynamic method getUri. --- app/router/Router.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/app/router/Router.php b/app/router/Router.php index 1a3b424..1f77dac 100644 --- a/app/router/Router.php +++ b/app/router/Router.php @@ -64,27 +64,26 @@ class Router return $this->route; } - public function routeIsExists($name) + protected function routeIsExists($name) { return array_key_exists($name, $this->routes); } - public function getRouteByName($name) + protected function getRouteByName($name) { return $this->routes[$name]; } - static public function getUri($route_name = null) + public function getUri($route_name = null) { - $router = FrontController::getInstance()->getRouter(); if (is_null($route_name)) { - $route = $router->getRoute(); + $route = $this->getRoute(); } else { - if ($router->routeIsExists($route_name)) { - $route = $router->getRouteByName($route_name); + if ($this->routeIsExists($route_name)) { + $route = $this->getRouteByName($route_name); } else { $btrace = debug_backtrace(); - throw new ErrorException('Unknown route handler: "' . $route_name . '". ' . 'Call from "' . $btrace[0]['file'] . '" on line ' . $btrace[0]['line'] . '.'); + throw new ErrorException('Unknown route name: "' . $route_name . '". ' . 'Call from "' . $btrace[0]['file'] . '" on line ' . $btrace[0]['line'] . '.'); } } return $route->getUri();