Add space between if and ‘(‘

[MAILPOET-1791]
This commit is contained in:
Ján Mikláš
2019-02-13 13:08:49 +01:00
committed by M. Shull
parent a935b091d3
commit 3ee58aea10
333 changed files with 4001 additions and 4001 deletions

View File

@ -31,19 +31,19 @@ class NewSubscriberNotificationMailer {
* @param Functions|null $wordpress_functions
*/
function __construct($mailer = null, $renderer = null, $wordpress_functions = null) {
if($renderer) {
if ($renderer) {
$this->renderer = $renderer;
} else {
$caching = !WP_DEBUG;
$debugging = WP_DEBUG;
$this->renderer = new Renderer($caching, $debugging);
}
if($wordpress_functions) {
if ($wordpress_functions) {
$this->wordpress_functions = $wordpress_functions;
} else {
$this->wordpress_functions = new Functions();
}
if($mailer) {
if ($mailer) {
$this->mailer = $mailer;
} else {
$this->mailer = new \MailPoet\Mailer\Mailer(false, $this->constructSenderEmail());
@ -59,30 +59,30 @@ class NewSubscriberNotificationMailer {
*/
function send(Subscriber $subscriber, array $segments) {
$settings = $this->settings->get(NewSubscriberNotificationMailer::SETTINGS_KEY);
if($this->isDisabled($settings)) {
if ($this->isDisabled($settings)) {
return;
}
try {
$this->mailer->getSenderNameAndAddress($this->constructSenderEmail());
$this->mailer->send($this->constructNewsletter($subscriber, $segments), $settings['address']);
} catch (\Exception $e) {
if(WP_DEBUG) {
if (WP_DEBUG) {
throw $e;
}
}
}
public static function isDisabled($settings) {
if(!is_array($settings)) {
if (!is_array($settings)) {
return true;
}
if(!isset($settings['enabled'])) {
if (!isset($settings['enabled'])) {
return true;
}
if(!isset($settings['address'])) {
if (!isset($settings['address'])) {
return true;
}
if(empty(trim($settings['address']))) {
if (empty(trim($settings['address']))) {
return true;
}
return !(bool)$settings['enabled'];
@ -91,7 +91,7 @@ class NewSubscriberNotificationMailer {
private function constructSenderEmail() {
$url_parts = parse_url($this->wordpress_functions->homeUrl());
$site_name = strtolower($url_parts['host']);
if(substr($site_name, 0, 4) === 'www.') {
if (substr($site_name, 0, 4) === 'www.') {
$site_name = substr($site_name, 4);
}
return [