Remove \Icinga\Backend class

refs #4575
This commit is contained in:
Marius Hein 2013-08-19 15:25:15 +02:00
parent eddbbd5f5b
commit 1b94eed945
1 changed files with 0 additions and 40 deletions

View File

@ -1,40 +0,0 @@
<?php
namespace Icinga;
use \Icinga\Application\Config as IcingaConfig;
use Icinga\Authentication\Manager as AuthManager;
class Backend
{
protected static $instances = array();
protected function __construct() {}
public static function getInstance($name = null)
{
if (! array_key_exists($name, self::$instances)) {
$backends = IcingaConfig::app('backends');
if ($name === null) {
$name = AuthManager::getInstance()->getSession()->get('backend');
}
if ($name === null) {
$backendKeys = array_keys($backends->toArray());
$name = array_shift($backendKeys);
}
if (isset($backends->$name)) {
$config = $backends->$name;
$type = $config->type;
$type[0] = strtoupper($type[0]);
$class = '\\Monitoring\\Backend\\' . $type;
self::$instances[$name] = new $class($config);
} else {
throw new \Exception(sprintf(
'Got no config for backend %s',
$name
));
}
}
return self::$instances[$name];
}
}