class MailgunFactory in Mailgun 8
Defines the mailgun factory.
Hierarchy
- class \Drupal\mailgun\MailgunFactory
Expanded class hierarchy of MailgunFactory
1 file declares its use of MailgunFactory
- MailgunFactoryTest.php in tests/
src/ Kernel/ MailgunFactoryTest.php
1 string reference to 'MailgunFactory'
1 service uses MailgunFactory
File
- src/
MailgunFactory.php, line 11
Namespace
Drupal\mailgunView source
class MailgunFactory {
/**
* Configuration object.
*
* @var \Drupal\Core\Config\ImmutableConfig
*/
protected $mailgunConfig;
/**
* Constructs MailgunFactory object.
*
* @param \Drupal\Core\Config\ConfigFactoryInterface $configFactory
* The config factory.
*/
public function __construct(ConfigFactoryInterface $configFactory) {
$this->mailgunConfig = $configFactory
->get(MailgunHandlerInterface::CONFIG_NAME);
}
/**
* Create Mailgun client.
*
* @return \Mailgun\Mailgun
* Mailgun PHP SDK Client.
*/
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'));
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MailgunFactory:: |
protected | property | Configuration object. | |
MailgunFactory:: |
public | function | Create Mailgun client. | |
MailgunFactory:: |
public | function | Constructs MailgunFactory object. |