protected function getTransport()
 {
     $instance = $this->params->get('instance');
     if ($instance = $this->params->get('instance')) {
         $transport = CommandTransport::create($instance);
     } else {
         $transport = CommandTransport::first();
     }
     return $transport;
 }
Exemple #2
0
 /**
  * Get the transport used to send commands
  *
  * @param   Request $request
  *
  * @return  \Icinga\Module\Monitoring\Command\Transport\CommandTransportInterface
  */
 public function getTransport(Request $request)
 {
     $instance = $request->getParam('instance');
     if ($instance !== null) {
         $transport = CommandTransport::create($instance);
     } else {
         $transport = CommandTransport::first();
     }
     return $transport;
 }
 /**
  * Get the transport used to send commands
  *
  * @param   Request     $request
  *
  * @return  CommandTransportInterface
  *
  * @throws  ConfigurationError
  */
 public function getTransport(Request $request)
 {
     if (($transportName = $request->getParam('transport')) !== null) {
         $config = CommandTransport::getConfig();
         if ($config->hasSection($transportName)) {
             $transport = CommandTransport::createTransport($config->getSection($transportName));
         } else {
             throw new ConfigurationError(sprintf(mt('monitoring', 'Command transport "%s" not found.'), $transportName));
         }
     } else {
         $transport = new CommandTransport();
     }
     return $transport;
 }