mirror of
https://github.com/yiisoft/yii2.git
synced 2025-12-01 15:07:49 +08:00
Added yii\base\Module::getParam($name, $defaultValue = null) to conveniently work with application parameters
This commit is contained in:
@@ -642,6 +642,18 @@ class Module extends Component
|
||||
return isset($controller) ? [$controller, $route] : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns parameter with a given name.
|
||||
*
|
||||
* @param string $name the parameter name
|
||||
* @param mixed $defaultValue the default parameter value if the parameter does not exist
|
||||
* @return mixed
|
||||
*/
|
||||
public function getParam($name, $defaultValue = null)
|
||||
{
|
||||
return isset($this->params[$name]) ? $this->params[$name] : $defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is invoked right before an action of this module is to be executed (after all possible filters.)
|
||||
* You may override this method to do last-minute preparation for the action.
|
||||
|
||||
Reference in New Issue
Block a user