Browse Source

improvement of Application::end() handling.

tags/2.0.0-beta
Qiang Xue 11 years ago
parent
commit
43b8430e0f
  1. 13
      framework/base/Application.php

13
framework/base/Application.php

@ -199,8 +199,6 @@ abstract class Application extends Module
$this->registerErrorHandlers();
Component::__construct($config);
$this->state = self::STATE_INIT;
}
/**
@ -260,6 +258,8 @@ abstract class Application extends Module
*/
public function init()
{
$this->state = self::STATE_INIT;
$this->initExtensions($this->extensions);
foreach ($this->bootstrap as $class) {
/** @var BootstrapInterface $bootstrap */
@ -346,6 +346,8 @@ abstract class Application extends Module
*/
public function run()
{
try {
$this->state = self::STATE_BEFORE_REQUEST;
$this->trigger(self::EVENT_BEFORE_REQUEST);
@ -361,6 +363,13 @@ abstract class Application extends Module
$this->state = self::STATE_END;
return $response->exitStatus;
} catch (ExitException $e) {
$this->end($e->statusCode, isset($response) ? $response : null);
return $e->statusCode;
}
}
/**

Loading…
Cancel
Save