public function getAction()
{
$action = null;
if (null !== $this->controller && null !== $this->controller->getRequest()) {
// If the URI is root '/', then set to 'index'
if ($this->controller->getRequest()->getRequestUri() == '/') {
$action = 'index';
// Else, figure out the action from the path stems
} else {
if ($this->controller->getRequest()->getPath(0) != '') {
$path = $this->controller->getRequest()->getPath();
$basePath = explode('/', substr($this->basePath, 1));
$pathDiff = array_values(array_diff($path, $basePath));
if (isset($pathDiff[0])) {
$realBasePath = substr($this->controller->getRequest()->getBasePath(), -1) == '/' ? substr($this->controller->getRequest()->getBasePath(), 0, -1) : $this->controller->getRequest()->getBasePath();
$this->controller->getRequest()->setRequestUri('/' . implode('/', $pathDiff), $realBasePath);
$action = $pathDiff[0];
}
}
}
}
return $action;
}