Multi.php

Go to the documentation of this file.
00001 <?php
00002 
00031 class Robo47_Mail_Transport_Multi extends Zend_Mail_Transport_Abstract
00032 {
00033 
00039     protected $_transports = array();
00040 
00044     public function __construct($transports = array())
00045     {
00046         $this->setTransports($transports);
00047     }
00048 
00055     public function setTransports($transports)
00056     {
00057         if (is_array($transports)) {
00058             foreach ($transports as $transport) {
00059                 $this->addTransport($transport);
00060             }
00061         } else {
00062             $this->addTransport($transports);
00063         }
00064         return $this;
00065     }
00066 
00073     public function addTransport(Zend_Mail_Transport_Abstract $transport)
00074     {
00075         $this->_transports[] = $transport;
00076         return $this;
00077     }
00078 
00084     public function getTransports()
00085     {
00086         return $this->_transports;
00087     }
00088 
00095     public function removeTransport($class)
00096     {
00097         foreach ($this->_transports as $key => $transport) {
00098             if (is_string($class)) {
00099                 if ($transport instanceof $class) {
00100                     unset($this->_transports[$key]);
00101                 }
00102             } elseif (is_object($class)) {
00103                 if ($class === $transport) {
00104                     unset($this->_transports[$key]);
00105                 }
00106             }
00107         }
00108         return $this;
00109     }
00110 
00119     public function send(Zend_Mail $mail)
00120     {
00121         foreach ($this->_transports as $transport) {
00122             /* @var $transport Zend_Mail_Transport_Abstract */
00123             $transport->send($mail);
00124         }
00125     }
00126 
00131     protected function _sendMail()
00132     {
00133         
00134     }
00135 }