stop() public method

Stop this Transport mechanism.
public stop ( )
 public function postTask(Worker $worker, array $options = null)
 {
     if ($worker instanceof MailerAwareWorker) {
         if ($this->mailer && $this->transport) {
             //Flush the mailer queue, this isn't normally done until the command execution finishes
             $this->mailer->getTransport()->getSpool()->flushQueue($this->transport);
             $this->transport->stop();
             $this->logger->info('Flushed mail queue');
         }
     }
 }
 /**
  * Sends messages using the given transport instance.
  *
  * @param \Swift_Transport $transport A transport instance
  * @param string[]         &$failedRecipients An array of failures by-reference
  *
  * @return int The number of sent emails
  */
 public function flushQueue(\Swift_Transport $transport, &$failedRecipients = null)
 {
     $repoClass = $this->doc->getManager()->getRepository($this->entityClass);
     $limit = $this->getMessageLimit();
     $limit = $limit > 0 ? $limit : null;
     $emails = $repoClass->findBy(array("status" => EmailInterface::STATUS_READY, "environment" => $this->environment), null, $limit);
     if (!count($emails)) {
         return 0;
     }
     $failedRecipients = (array) $failedRecipients;
     $count = 0;
     $time = time();
     foreach ($emails as $email) {
         $email->setStatus(EmailInterface::STATUS_PROCESSING);
         $this->doc->getManager()->persist($email);
         $this->doc->getManager()->flush($email);
         $message = unserialize($email->getMessage());
         if (!$transport->isStarted()) {
             $transport->start();
         }
         $count += $transport->send($message, $failedRecipients);
         $transport->stop();
         if ($this->keepSentMessages === true) {
             $email->setStatus(EmailInterface::STATUS_COMPLETE);
             $this->doc->getManager()->persist($email);
         } else {
             $this->doc->getManager()->remove($email);
         }
         $this->doc->getManager()->flush($email);
         if ($this->getTimeLimit() && time() - $time >= $this->getTimeLimit()) {
             break;
         }
     }
     return $count;
 }