Add public keyword to methods

[MAILPOET-2413]
This commit is contained in:
Amine Ben hammou
2019-12-26 12:56:49 +01:00
committed by wxa
parent ec409042d5
commit 43df66d162
823 changed files with 4440 additions and 4440 deletions

View File

@ -23,12 +23,12 @@ class AuthorizedEmailsController {
Newsletter::TYPE_AUTOMATIC,
];
function __construct(SettingsController $settingsController, Bridge $bridge) {
public function __construct(SettingsController $settingsController, Bridge $bridge) {
$this->settings = $settingsController;
$this->bridge = $bridge;
}
function checkAuthorizedEmailAddresses() {
public function checkAuthorizedEmailAddresses() {
if (!Bridge::isMPSendingServiceEnabled()) {
$this->settings->set(self::AUTHORIZED_EMAIL_ADDRESSES_ERROR_SETTING, null);
$this->updateMailerLog();
@ -49,14 +49,14 @@ class AuthorizedEmailsController {
$this->updateMailerLog($result);
}
function onSettingsSave($settings) {
public function onSettingsSave($settings) {
$sender_address_set = !empty($settings['sender']['address']);
if ($sender_address_set) {
$this->checkAuthorizedEmailAddresses();
}
}
function onNewsletterUpdate(Newsletter $newsletter, Newsletter $old_newsletter = null) {
public function onNewsletterUpdate(Newsletter $newsletter, Newsletter $old_newsletter = null) {
if ($old_newsletter === null || $newsletter->sender_address === $old_newsletter->sender_address) {
return;
}

View File

@ -36,14 +36,14 @@ class Bridge {
/** @var SettingsController */
private $settings;
function __construct(SettingsController $settingsController = null) {
public function __construct(SettingsController $settingsController = null) {
if ($settingsController === null) {
$settingsController = SettingsController::getInstance();
}
$this->settings = $settingsController;
}
static function isMPSendingServiceEnabled() {
public static function isMPSendingServiceEnabled() {
try {
$mailer_config = SettingsController::getInstance()->get(Mailer::MAILER_CONFIG_SETTING_NAME);
return !empty($mailer_config['method'])
@ -53,19 +53,19 @@ class Bridge {
}
}
static function isMSSKeySpecified() {
public static function isMSSKeySpecified() {
$settings = SettingsController::getInstance();
$key = $settings->get(self::API_KEY_SETTING_NAME);
return !empty($key);
}
static function isPremiumKeySpecified() {
public static function isPremiumKeySpecified() {
$settings = SettingsController::getInstance();
$key = $settings->get(self::PREMIUM_KEY_SETTING_NAME);
return !empty($key);
}
static function pingBridge() {
public static function pingBridge() {
$params = [
'blocking' => true,
'timeout' => 10,
@ -75,7 +75,7 @@ class Bridge {
return $wp->wpRemoteRetrieveResponseCode($result) === 200;
}
function initApi($api_key) {
public function initApi($api_key) {
if ($this->api) {
$this->api->setKey($api_key);
} else {
@ -93,20 +93,20 @@ class Bridge {
return $this->api;
}
function getAuthorizedEmailAddresses() {
public function getAuthorizedEmailAddresses() {
return $this
->getApi($this->settings->get(self::API_KEY_SETTING_NAME))
->getAuthorizedEmailAddresses();
}
function checkMSSKey($api_key) {
public function checkMSSKey($api_key) {
$result = $this
->getApi($api_key)
->checkMSSKey();
return $this->processKeyCheckResult($result);
}
function storeMSSKeyAndState($key, $state) {
public function storeMSSKeyAndState($key, $state) {
if (empty($state['state'])
|| $state['state'] === self::KEY_CHECK_ERROR
) {
@ -126,7 +126,7 @@ class Bridge {
);
}
function checkPremiumKey($key) {
public function checkPremiumKey($key) {
$result = $this
->getApi($key)
->checkPremiumKey();
@ -159,7 +159,7 @@ class Bridge {
);
}
function storePremiumKeyAndState($key, $state) {
public function storePremiumKeyAndState($key, $state) {
if (empty($state['state'])
|| $state['state'] === self::KEY_CHECK_ERROR
) {
@ -189,7 +189,7 @@ class Bridge {
return $state;
}
function updateSubscriberCount($result) {
public function updateSubscriberCount($result) {
if (
(
!empty($result['state'])
@ -205,7 +205,7 @@ class Bridge {
return null;
}
static function invalidateKey() {
public static function invalidateKey() {
$settings = SettingsController::getInstance();
$settings->set(
self::API_KEY_STATE_SETTING_NAME,
@ -213,7 +213,7 @@ class Bridge {
);
}
function onSettingsSave($settings) {
public function onSettingsSave($settings) {
$api_key_set = !empty($settings[Mailer::MAILER_CONFIG_SETTING_NAME]['mailpoet_api_key']);
$premium_key_set = !empty($settings['premium']['premium_key']);
if ($api_key_set) {

View File

@ -32,7 +32,7 @@ class API {
public $url_stats = 'https://bridge.mailpoet.com/api/v0/stats';
public $url_authorized_email_addresses = 'https://bridge.mailpoet.com/api/v0/authorized_email_addresses';
function __construct($api_key, $wp = null) {
public function __construct($api_key, $wp = null) {
$this->setKey($api_key);
if (is_null($wp)) {
$this->wp = new WPFunctions();
@ -42,7 +42,7 @@ class API {
$this->logger_factory = LoggerFactory::getInstance();
}
function checkMSSKey() {
public function checkMSSKey() {
$result = $this->request(
$this->url_me,
['site' => WPFunctions::get()->homeUrl()]
@ -61,7 +61,7 @@ class API {
return ['code' => $code, 'data' => $body];
}
function checkPremiumKey() {
public function checkPremiumKey() {
$result = $this->request(
$this->url_premium,
['site' => WPFunctions::get()->homeUrl()]
@ -83,14 +83,14 @@ class API {
return ['code' => $code, 'data' => $body];
}
function logCurlInformation($headers, $info) {
public function logCurlInformation($headers, $info) {
$this->logger_factory->getLogger(LoggerFactory::TOPIC_MSS)->addInfo(
'requests-curl.after_request',
['headers' => $headers, 'curl_info' => $info]
);
}
function sendMessages($message_body) {
public function sendMessages($message_body) {
add_action('requests-curl.after_request', [$this, 'logCurlInformation'], 10, 2);
$result = $this->request(
$this->url_messages,
@ -118,7 +118,7 @@ class API {
return ['status' => self::SENDING_STATUS_OK];
}
function checkBounces(array $emails) {
public function checkBounces(array $emails) {
$result = $this->request(
$this->url_bounces,
$emails
@ -129,7 +129,7 @@ class API {
return false;
}
function updateSubscriberCount($count) {
public function updateSubscriberCount($count) {
$result = $this->request(
$this->url_stats,
['subscriber_count' => (int)$count],
@ -138,7 +138,7 @@ class API {
return $this->wp->wpRemoteRetrieveResponseCode($result) === self::RESPONSE_CODE_STATS_SAVED;
}
function getAuthorizedEmailAddresses() {
public function getAuthorizedEmailAddresses() {
$result = $this->request(
$this->url_authorized_email_addresses,
null,
@ -150,11 +150,11 @@ class API {
return false;
}
function setKey($api_key) {
public function setKey($api_key) {
$this->api_key = $api_key;
}
function getKey() {
public function getKey() {
return $this->api_key;
}

View File

@ -9,12 +9,12 @@ class API {
private $wp;
public $url_products = 'https://release.mailpoet.com/products/';
function __construct($api_key) {
public function __construct($api_key) {
$this->setKey($api_key);
$this->wp = new WPFunctions();
}
function getPluginInformation($plugin_name) {
public function getPluginInformation($plugin_name) {
$result = $this->request(
$this->url_products . $plugin_name
);
@ -35,11 +35,11 @@ class API {
return $body;
}
function setKey($api_key) {
public function setKey($api_key) {
$this->api_key = $api_key;
}
function getKey() {
public function getKey() {
return $this->api_key;
}

View File

@ -3,7 +3,7 @@
namespace MailPoet\Services;
class SPFCheck {
function checkSPFRecord($domain) {
public function checkSPFRecord($domain) {
$record = $this->getSPFRecord($domain);
if (empty($record)) {
return true;