icingaweb2/library/Icinga/Web/Controller/ModuleActionController.php
Thomas Gelf 373e1c5ecb Web\Controller: re-introduce ModuleActionController
This will help getting rid of a couple of if/else constructs
2014-06-22 12:03:37 +02:00

30 lines
695 B
PHP

<?php
namespace Icinga\Web\Controller;
class ModuleActionController extends ActionController
{
private $config;
private $configs = array();
public function Config($file = null)
{
$module = $this->getRequest()->getModuleName();
$this->moduleName = $module;
if ($tile === null) {
if ($this->config === null) {
$this->config = Config::module($module);
}
return $this->config;
} else {
if (! array_key_exists($file, $this->configs)) {
$this->configs[$file] = Config::module($module, $file);
}
return $this->configs[$file];
}
}
}