/**
  * @param SubjectInterface  $subject
  * @param IncidentInterface $incident
  */
 public function notify(SubjectInterface $subject, IncidentInterface $incident)
 {
     if ($incident->getStatus() != IncidentInterface::STATUS_OK) {
         $message = Swift_Message::newInstance()->setTo($subject->getTarget())->setFrom($this->getFrom(), $this->getFromName())->setSubject(sprintf(self::EMAIL_SUBJECT_T, $incident->getIdent()))->setBody(sprintf(self::EMAIL_BODY_T, $incident->getMessage(), $incident->getType()));
         $this->getMailer()->send($message);
         $this->getMailer()->getTransport()->stop();
     }
 }
 /**
  * @param IncidentInterface $entity
  */
 protected function preUpdateIncidentStatus(IncidentInterface $entity)
 {
     /** @var IncidentSiren $incidentI */
     foreach ($this->getIncidentSirenCollection() as $incidentI) {
         if (isset(static::$typeEventPolitic[$entity->getType()]) && $this->checkIsNotificationAllow($entity->getType(), $incidentI->getNotificationTypeI())) {
             $entity->attach($incidentI);
         } else {
             $entity->detach($incidentI);
         }
     }
 }
 /**
  * @param SubjectInterface  $subject
  * @param IncidentInterface $incident
  */
 public function notify(SubjectInterface $subject, IncidentInterface $incident)
 {
     $event = new Event();
     $event->serviceKey = $this->getServiceKey();
     $event->incidentKey = sprintf('hci_%d', $incident->getId());
     if ($incident->getStatus() != IncidentInterface::STATUS_OK) {
         $event->description = $incident->getIdent();
         $event->eventType = Event::EVENT_TYPE_TRIGGER;
         $event->details = ['log' => $incident->getMessage(), 'status' => $incident->getStatus(), 'type' => $incident->getType(), 'id' => $incident->getId()];
     } else {
         $event->eventType = Event::EVENT_TYPE_RESOLVE;
     }
     $this->getEventClient()->post($event);
 }
 /**
  * @param SubjectInterface  $subject
  * @param IncidentInterface $incident
  */
 public function notify(SubjectInterface $subject, IncidentInterface $incident)
 {
     if ($incident->getStatus() != IncidentInterface::STATUS_OK) {
         file_put_contents($this->getSubjectNotifyFilePath($subject), $incident->getMessage());
     }
 }
 /**
  * @param IncidentInterface $incident
  * @param $serverUrl
  */
 protected function incidentUpdate(IncidentInterface $incident, $serverUrl)
 {
     $this->getHttpClient()->put($serverUrl . $this->getResourceUrl() . '/' . $incident->getExternalId(), ['Content-type' => 'application/json'], json_encode(['status' => 4]));
 }