public function call($pathChunks = array(), $permissionFlag = true)
{
$arg = array_shift($pathChunks);
try {
$subController = self::loadController($arg, get_class($this), true);
} catch (Scalr_UI_Exception_NotFound $e) {
$subController = null;
}
if ($subController) {
$this->addUiCacheKeyPatternChunk($arg);
$subController->uiCacheKeyPattern = $this->uiCacheKeyPattern;
$subController->call($pathChunks, $permissionFlag);
} else {
if (($action = $arg . 'Action') && method_exists($this, $action)) {
$this->addUiCacheKeyPatternChunk($arg);
$this->response->setHeader('X-Scalr-Cache-Id', $this->uiCacheKeyPattern);
if (!$permissionFlag) {
throw new Scalr_Exception_InsufficientPermissions();
}
$this->unusedPathChunks = $pathChunks;
$this->callActionMethod($action);
} else {
if (count($pathChunks) > 0) {
$constName = get_class($this) . '::CALL_PARAM_NAME';
if (defined($constName)) {
$const = constant($constName);
$this->request->setParams(array($const => $arg));
$this->addUiCacheKeyPatternChunk('{' . $const . '}');
} else {
// Invar: notice
}
$this->call($pathChunks, $permissionFlag);
} else {
if (method_exists($this, 'defaultAction') && $arg == '') {
$this->response->setHeader('X-Scalr-Cache-Id', $this->uiCacheKeyPattern);
if (!$permissionFlag) {
throw new Scalr_Exception_InsufficientPermissions();
}
$this->callActionMethod('defaultAction');
} else {
throw new Scalr_UI_Exception_NotFound();
}
}
}
}
}