TYPO3  7.6
Transport/NullTransport.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of SwiftMailer.
5  * (c) 2009 Fabien Potencier <fabien.potencier@gmail.com>
6  *
7  * For the full copyright and license information, please view the LICENSE
8  * file that was distributed with this source code.
9  */
10 
17 {
20 
24  public function __construct(Swift_Events_EventDispatcher $eventDispatcher)
25  {
26  $this->_eventDispatcher = $eventDispatcher;
27  }
28 
34  public function isStarted()
35  {
36  return true;
37  }
38 
42  public function start()
43  {
44  }
45 
49  public function stop()
50  {
51  }
52 
61  public function send(Swift_Mime_Message $message, &$failedRecipients = null)
62  {
63  if ($evt = $this->_eventDispatcher->createSendEvent($this, $message)) {
64  $this->_eventDispatcher->dispatchEvent($evt, 'beforeSendPerformed');
65  if ($evt->bubbleCancelled()) {
66  return 0;
67  }
68  }
69 
70  if ($evt) {
72  $this->_eventDispatcher->dispatchEvent($evt, 'sendPerformed');
73  }
74 
75  $count = (
76  count((array) $message->getTo())
77  + count((array) $message->getCc())
78  + count((array) $message->getBcc())
79  );
80 
81  return $count;
82  }
83 
89  public function registerPlugin(Swift_Events_EventListener $plugin)
90  {
91  $this->_eventDispatcher->bindEventListener($plugin);
92  }
93 }