Ejemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function send($template, array $recipients, array $data = array())
 {
     $data = $this->twig->mergeGlobals($data);
     $template = $this->twig->loadTemplate($template);
     $content = $template->renderBlock('content', $data);
     $originator = $template->renderBlock('originator', $data);
     $this->sender->send($recipients[0], $content, $originator);
 }
Ejemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function send($recipient, $body, $originator = '')
 {
     $this->activateProvider();
     if ($this->logger) {
         $time = microtime(true);
         $result = $this->sender->send($recipient, $body, $originator);
         $duration = microtime(true) - $time;
         $this->logger->logMessage($result, $duration, $this->getProviderClass());
     } else {
         $result = $this->sender->send($recipient, $body, $originator);
     }
     $this->recordProvider->storeResult($result);
     return $result;
 }
Ejemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 public function flush(SmsSenderInterface $sender)
 {
     $results = array();
     $errors = array();
     foreach ($this->messages as $message) {
         try {
             $results[] = $sender->send($message['recipient'], $message['body'], $message['originator']);
         } catch (Exception $e) {
             $errors[] = $e;
         }
     }
     return array($results, $errors);
 }