MailgunFactory.php in Mailgun 8
File
src/MailgunFactory.php
View source
<?php
namespace Drupal\mailgun;
use Drupal\Core\Config\ConfigFactoryInterface;
use Mailgun\Mailgun;
class MailgunFactory {
protected $mailgunConfig;
public function __construct(ConfigFactoryInterface $configFactory) {
$this->mailgunConfig = $configFactory
->get(MailgunHandlerInterface::CONFIG_NAME);
}
public function create() {
if ($endpoint = $this->mailgunConfig
->get('api_endpoint')) {
return Mailgun::create($this->mailgunConfig
->get('api_key'), $endpoint);
}
else {
return Mailgun::create($this->mailgunConfig
->get('api_key'));
}
}
}