コード例 #1
0
 protected function getTransport()
 {
     $instance = $this->params->get('instance');
     if ($instance = $this->params->get('instance')) {
         $transport = CommandTransport::create($instance);
     } else {
         $transport = CommandTransport::first();
     }
     return $transport;
 }
コード例 #2
0
ファイル: CommandForm.php プロジェクト: hsanjuan/icingaweb2
 /**
  * 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;
 }
コード例 #3
0
 /**
  * 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;
 }