Convert variable names to camel case

[MAILPOET-1796]
This commit is contained in:
Jan Jakeš
2020-01-09 15:02:58 +01:00
committed by Jan Jakeš
parent f5da704106
commit 54549ff037
687 changed files with 15890 additions and 15887 deletions

View File

@@ -10,7 +10,7 @@ class WelcomeScheduler {
const WORDPRESS_ALL_ROLES = 'mailpoet_all';
public function scheduleSubscriberWelcomeNotification($subscriber_id, $segments) {
public function scheduleSubscriberWelcomeNotification($subscriberId, $segments) {
$newsletters = Scheduler::getNewsletters(Newsletter::TYPE_WELCOME);
if (empty($newsletters)) return false;
$result = [];
@@ -18,56 +18,56 @@ class WelcomeScheduler {
if ($newsletter->event === 'segment' &&
in_array($newsletter->segment, $segments)
) {
$result[] = $this->createWelcomeNotificationSendingTask($newsletter, $subscriber_id);
$result[] = $this->createWelcomeNotificationSendingTask($newsletter, $subscriberId);
}
}
return $result;
}
public function scheduleWPUserWelcomeNotification(
$subscriber_id,
$wp_user,
$old_user_data = false
$subscriberId,
$wpUser,
$oldUserData = false
) {
$newsletters = Scheduler::getNewsletters(Newsletter::TYPE_WELCOME);
if (empty($newsletters)) return false;
foreach ($newsletters as $newsletter) {
if ($newsletter->event === 'user') {
if (!empty($old_user_data['roles'])) {
if (!empty($oldUserData['roles'])) {
// do not schedule welcome newsletter if roles have not changed
$old_role = $old_user_data['roles'];
$new_role = $wp_user['roles'];
$oldRole = $oldUserData['roles'];
$newRole = $wpUser['roles'];
if ($newsletter->role === self::WORDPRESS_ALL_ROLES ||
!array_diff($old_role, $new_role)
!array_diff($oldRole, $newRole)
) {
continue;
}
}
if ($newsletter->role === self::WORDPRESS_ALL_ROLES ||
in_array($newsletter->role, $wp_user['roles'])
in_array($newsletter->role, $wpUser['roles'])
) {
$this->createWelcomeNotificationSendingTask($newsletter, $subscriber_id);
$this->createWelcomeNotificationSendingTask($newsletter, $subscriberId);
}
}
}
}
public function createWelcomeNotificationSendingTask($newsletter, $subscriber_id) {
$previously_scheduled_notification = SendingQueue::joinWithSubscribers()
public function createWelcomeNotificationSendingTask($newsletter, $subscriberId) {
$previouslyScheduledNotification = SendingQueue::joinWithSubscribers()
->where('queues.newsletter_id', $newsletter->id)
->where('subscribers.subscriber_id', $subscriber_id)
->where('subscribers.subscriber_id', $subscriberId)
->findOne();
if (!empty($previously_scheduled_notification)) return;
$sending_task = SendingTask::create();
$sending_task->newsletter_id = $newsletter->id;
$sending_task->setSubscribers([$subscriber_id]);
$sending_task->status = SendingQueue::STATUS_SCHEDULED;
$sending_task->priority = SendingQueue::PRIORITY_HIGH;
$sending_task->scheduled_at = Scheduler::getScheduledTimeWithDelay(
if (!empty($previouslyScheduledNotification)) return;
$sendingTask = SendingTask::create();
$sendingTask->newsletterId = $newsletter->id;
$sendingTask->setSubscribers([$subscriberId]);
$sendingTask->status = SendingQueue::STATUS_SCHEDULED;
$sendingTask->priority = SendingQueue::PRIORITY_HIGH;
$sendingTask->scheduledAt = Scheduler::getScheduledTimeWithDelay(
$newsletter->afterTimeType,
$newsletter->afterTimeNumber
);
return $sending_task->save();
return $sendingTask->save();
}
}