monitoring: Use command transports constants in the command transport factory

This commit is contained in:
Eric Lippmann 2014-10-30 09:53:55 +01:00
parent 1b83ec3ce2
commit 0bf6dc24a8
1 changed files with 6 additions and 4 deletions

View File

@ -53,19 +53,21 @@ abstract class CommandTransport
public static function fromConfig(Zend_Config $config)
{
switch (strtolower($config->transport)) {
case 'remote':
case RemoteCommandFile::TRANSPORT:
$transport = new RemoteCommandFile();
break;
case 'local':
case LocalCommandFile::TRANSPORT:
case '': // Casting null to string is the empty string
$transport = new LocalCommandFile();
break;
default:
throw new ConfigurationError(
'Can\'t create command transport \'%s\'. Invalid transport defined in \'%s\'.'
. ' Use one of \'local\' or \'remote\'.',
. ' Use one of \'%s\' or \'%s\'.',
$config->transport,
self::$config->getConfigFile()
self::$config->getConfigFile(),
LocalCommandFile::TRANSPORT,
RemoteCommandFile::TRANSPORT
);
}
unset($config->transport);