FailoverTransport.php 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /*
  3. * This file is part of SwiftMailer.
  4. * (c) 2004-2009 Chris Corbyn
  5. *
  6. * For the full copyright and license information, please view the LICENSE
  7. * file that was distributed with this source code.
  8. */
  9. /**
  10. * Contains a list of redundant Transports so when one fails, the next is used.
  11. *
  12. * @package Swift
  13. * @subpackage Transport
  14. * @author Chris Corbyn
  15. */
  16. class Swift_FailoverTransport extends Swift_Transport_FailoverTransport
  17. {
  18. /**
  19. * Creates a new FailoverTransport with $transports.
  20. *
  21. * @param Swift_Transport[] $transports
  22. */
  23. public function __construct($transports = array())
  24. {
  25. call_user_func_array(
  26. array($this, 'Swift_Transport_FailoverTransport::__construct'),
  27. Swift_DependencyContainer::getInstance()
  28. ->createDependenciesFor('transport.failover')
  29. );
  30. $this->setTransports($transports);
  31. }
  32. /**
  33. * Create a new FailoverTransport instance.
  34. *
  35. * @param Swift_Transport[] $transports
  36. *
  37. * @return Swift_FailoverTransport
  38. */
  39. public static function newInstance($transports = array())
  40. {
  41. return new self($transports);
  42. }
  43. }