mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-18 15:31:06 +08:00
Renamed methods and events in Application.
This commit is contained in:
@@ -17,8 +17,14 @@ use Yii;
|
|||||||
*/
|
*/
|
||||||
class Application extends Module
|
class Application extends Module
|
||||||
{
|
{
|
||||||
const EVENT_BEFORE_REQUEST = 'beforeRequest';
|
/**
|
||||||
const EVENT_AFTER_REQUEST = 'afterRequest';
|
* @event Event an event that is triggered at the beginning of [[run()]].
|
||||||
|
*/
|
||||||
|
const EVENT_BEFORE_RUN = 'beforeRun';
|
||||||
|
/**
|
||||||
|
* @event Event an event that is triggered at the end of [[run()]].
|
||||||
|
*/
|
||||||
|
const EVENT_AFTER_RUN = 'afterRun';
|
||||||
/**
|
/**
|
||||||
* @var string the application name.
|
* @var string the application name.
|
||||||
*/
|
*/
|
||||||
@@ -148,7 +154,7 @@ class Application extends Module
|
|||||||
if (!$this->_ended) {
|
if (!$this->_ended) {
|
||||||
$this->_ended = true;
|
$this->_ended = true;
|
||||||
$this->getResponse()->end();
|
$this->getResponse()->end();
|
||||||
$this->afterRequest();
|
$this->afterRun();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($exit) {
|
if ($exit) {
|
||||||
@@ -163,29 +169,29 @@ class Application extends Module
|
|||||||
*/
|
*/
|
||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
$this->beforeRequest();
|
$this->beforeRun();
|
||||||
$response = $this->getResponse();
|
$response = $this->getResponse();
|
||||||
$response->begin();
|
$response->begin();
|
||||||
$status = $this->processRequest();
|
$status = $this->processRequest();
|
||||||
$response->end();
|
$response->end();
|
||||||
$this->afterRequest();
|
$this->afterRun();
|
||||||
return $status;
|
return $status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Raises the [[EVENT_BEFORE_REQUEST]] event right BEFORE the application processes the request.
|
* Raises the [[EVENT_BEFORE_RUN]] event right BEFORE the application processes the request.
|
||||||
*/
|
*/
|
||||||
public function beforeRequest()
|
public function beforeRun()
|
||||||
{
|
{
|
||||||
$this->trigger(self::EVENT_BEFORE_REQUEST);
|
$this->trigger(self::EVENT_BEFORE_RUN);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Raises the [[EVENT_AFTER_REQUEST]] event right AFTER the application processes the request.
|
* Raises the [[EVENT_AFTER_RUN]] event right AFTER the application processes the request.
|
||||||
*/
|
*/
|
||||||
public function afterRequest()
|
public function afterRun()
|
||||||
{
|
{
|
||||||
$this->trigger(self::EVENT_AFTER_REQUEST);
|
$this->trigger(self::EVENT_AFTER_RUN);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user