refactoring the uri class.
This commit is contained in:
parent
8443cef301
commit
a6d487ecd4
|
@ -108,7 +108,7 @@ public function connect()
|
||||||
* @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 @@ protected function command($method, $parameters)
|
||||||
*/
|
*/
|
||||||
public function __call($method, $parameters)
|
public function __call($method, $parameters)
|
||||||
{
|
{
|
||||||
return $this->do($method, $parameters);
|
return $this->run($method, $parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -47,27 +47,22 @@ public function get()
|
||||||
/**
|
/**
|
||||||
* 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));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue