123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- <?php
- namespace Cube\Mail\Transport;
- use Cube\Mail;
- abstract class AbstractTransport
- {
-
- protected $_mail;
-
- protected $_options;
-
- public function __construct(array $options = null)
- {
- $this->setOptions($options);
- }
-
- public function getOptions()
- {
- return $this->_options;
- }
-
- public function setOptions($options)
- {
- $this->_options = (array)$options;
- foreach ($this->_options as $key => $value) {
- $methodName = 'set' . ucfirst($key);
- if (method_exists($this, $methodName)) {
- $this->$methodName($value);
- }
- }
- return $this;
- }
-
- public function getMail()
- {
- if (!$this->_mail instanceof Mail) {
- throw new \RuntimeException("An object of type \Cube\Mail
- is required by the mail transport class.");
- }
- return $this->_mail;
- }
-
- public function setMail(Mail $mail)
- {
- $this->_mail = $mail;
- return $this;
- }
- abstract public function send();
- }
|