Commit a6d487ec authored by Taylor Otwell's avatar Taylor Otwell

refactoring the uri class.

parent 8443cef3
...@@ -108,7 +108,7 @@ class Redis { ...@@ -108,7 +108,7 @@ class Redis {
* @param array $parameters * @param array $parameters
* @return mixed * @return mixed
*/ */
public function do($method, $parameters) public function run($method, $parameters)
{ {
fwrite($this->connection, $this->command($method, $parameters)); fwrite($this->connection, $this->command($method, $parameters));
...@@ -139,7 +139,7 @@ class Redis { ...@@ -139,7 +139,7 @@ class Redis {
*/ */
public function __call($method, $parameters) public function __call($method, $parameters)
{ {
return $this->do($method, $parameters); return $this->run($method, $parameters);
} }
/** /**
......
...@@ -47,27 +47,22 @@ class URI { ...@@ -47,27 +47,22 @@ class URI {
/** /**
* Remove extraneous information from the given request URI. * Remove extraneous information from the given request URI.
* *
* The application URL will be removed, as well as the application index file
* and the request format. None of these things are used when routing the
* request to a closure or controller, so they can be safely removed.
*
* @param string $uri * @param string $uri
* @return string * @return string
*/ */
protected function clean($uri) protected function clean($uri)
{ {
// The base application URL is removed first. If the application is being
// served out of a sub-directory of the web document root, we need to get
// rid of the folders that are included in the URI.
$uri = $this->remove($uri, parse_url(Config::$items['application']['url'], PHP_URL_PATH)); $uri = $this->remove($uri, parse_url(Config::$items['application']['url'], PHP_URL_PATH));
// Next, the application index file is removed. The index file has nothing
// to do with how the request is routed to a closure or controller, so it
// can be safely removed from the URI.
if (($index = '/'.Config::$items['application']['index']) !== '/') if (($index = '/'.Config::$items['application']['index']) !== '/')
{ {
$uri = $this->remove($uri, $index); $uri = $this->remove($uri, $index);
} }
// We don't consider the request format to be a part of the request URI.
// The format merely determines in which format the requested resource
// should be returned to the client.
return rtrim($uri, '.'.Request::format($uri)); return rtrim($uri, '.'.Request::format($uri));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment