refactoring the uri class.

This commit is contained in:
Taylor Otwell 2011-10-24 23:15:29 -05:00
parent 8443cef301
commit a6d487ecd4
2 changed files with 6 additions and 11 deletions

View File

@ -108,7 +108,7 @@ public function connect()
* @param array $parameters
* @return mixed
*/
public function do($method, $parameters)
public function run($method, $parameters)
{
fwrite($this->connection, $this->command($method, $parameters));
@ -139,7 +139,7 @@ protected function command($method, $parameters)
*/
public function __call($method, $parameters)
{
return $this->do($method, $parameters);
return $this->run($method, $parameters);
}
/**

View File

@ -47,27 +47,22 @@ public function get()
/**
* 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
* @return string
*/
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));
// 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']) !== '/')
{
$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));
}