Better naming for loadIfNot argument of Module::getModule and Module::getComponent

This commit is contained in:
Alexander Makarov
2012-04-10 20:54:19 +02:00
parent e585c69fbb
commit b9a30b3024

View File

@@ -201,17 +201,17 @@ abstract class Module extends Component implements Initable
/**
* Retrieves the named module.
* @param string $id module ID (case-sensitive)
* @param boolean $loadIfNot whether to load the module if it is not yet.
* @param boolean $load whether to load the module if it is not yet loaded.
* @return Module|null the module instance, null if the module
* does not exist.
* @see hasModule()
*/
public function getModule($id, $loadIfNot = true)
public function getModule($id, $load = true)
{
if (isset($this->_modules[$id])) {
if ($this->_modules[$id] instanceof Module) {
return $this->_modules[$id];
} elseif ($loadIfNot) {
} elseif ($load) {
\Yii::trace("Loading \"$id\" module", __CLASS__);
return $this->_modules[$id] = \Yii::createObject($this->_modules[$id], $id, $this);
}
@@ -308,17 +308,17 @@ abstract class Module extends Component implements Initable
/**
* Retrieves the named application component.
* @param string $id application component ID (case-sensitive)
* @param boolean $loadIfNot whether to load the component if it is not yet.
* @param boolean $load whether to load the component if it is not yet loaded.
* @return ApplicationComponent|null the application component instance, null if the application component
* does not exist.
* @see hasComponent()
*/
public function getComponent($id, $loadIfNot = true)
public function getComponent($id, $load = true)
{
if (isset($this->_components[$id])) {
if ($this->_components[$id] instanceof ApplicationComponent) {
return $this->_components[$id];
} elseif ($loadIfNot) {
} elseif ($load) {
\Yii::trace("Loading \"$id\" application component", __CLASS__);
return $this->_components[$id] = \Yii::createObject($this->_components[$id]);
}