public function run()
{
try {
$this->initApplication();
$n = count(self::$_steps);
$this->_step = 0;
$this->_requestCompleted = false;
while ($this->_step < $n) {
if ($this->_mode === self::STATE_OFF) {
throw new THttpException(503, 'application_unavailable');
}
if ($this->_requestCompleted) {
break;
}
$method = self::$_steps[$this->_step];
Prado::trace("Executing {$method}()", 'Prado\\TApplication');
$this->{$method}();
$this->_step++;
}
} catch (\Exception $e) {
$this->onError($e);
}
$this->onEndRequest();
}