public function getPath()
{
$path = preg_replace('/\\?.*$/', '', $_SERVER['REQUEST_URI']);
// remove root from path
if ($this->root) {
$path = preg_replace('/^' . preg_quote($this->root, '/') . '/', '', $path);
}
// remove trailing format definition, like /controller/action.json -> /controller/action
$path = preg_replace('/\\.(\\w+)$/i', '', $path);
// remove root path from path, like /root/path/api -> /api
if ($this->rootPath) {
$path = str_replace($this->rootPath, '', $path);
}
return $path;
}