Exemplo n.º 1
0
 /**
  * Constructor
  *
  * @param \Zend\Config\Config $config  SMS configuration
  * @param array               $options Additional options: defaultFrom (optional)
  * and mailer (must be a \VuFind\Mailer\Mailer object)
  */
 public function __construct(\Zend\Config\Config $config, $options = [])
 {
     // Set up parent object first:
     parent::__construct($config, $options);
     // If found, use carriers from SMS configuration; otherwise, fall back to the
     // default list of US carriers.
     if (isset($config->Carriers) && count($config->Carriers) > 0) {
         $this->carriers = [];
         foreach ($config->Carriers as $id => $settings) {
             list($domain, $name) = explode(':', $settings, 2);
             $this->carriers[$id] = ['name' => $name, 'domain' => $domain];
         }
     }
     // Load default "from" address:
     $this->defaultFrom = isset($options['defaultFrom']) ? $options['defaultFrom'] : '';
     // Make sure mailer dependency has been injected:
     if (!isset($options['mailer']) || !$options['mailer'] instanceof \VuFind\Mailer\Mailer) {
         throw new \Exception('$options["mailer"] must be a \\VuFind\\Mailer\\Mailer');
     }
     $this->mailer = $options['mailer'];
 }
Exemplo n.º 2
0
 /**
  * Constructor
  *
  * @param \Zend\Config\Config $config  SMS configuration
  * @param array               $options Additional options (client may be an HTTP
  * client object)
  */
 public function __construct(\Zend\Config\Config $config, $options = [])
 {
     parent::__construct($config, $options);
     $this->client = isset($options['client']) ? $options['client'] : new \Zend\Http\Client();
 }