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

@@ -7,7 +7,7 @@ use MailPoet\Models\ScheduledTaskSubscriber;
use MailPoet\Models\Subscriber;
class Bounce {
static function prepareSubscribers(ScheduledTask $task) {
public static function prepareSubscribers(ScheduledTask $task) {
// Prepare subscribers on the DB side for performance reasons
Subscriber::rawExecute(
'INSERT IGNORE INTO ' . MP_SCHEDULED_TASK_SUBSCRIBERS_TABLE . '

View File

@@ -70,11 +70,11 @@ class Sending {
$this->task_subscribers = new Subscribers($task);
}
static function create(ScheduledTask $task = null, SendingQueue $queue = null) {
public static function create(ScheduledTask $task = null, SendingQueue $queue = null) {
return new self($task, $queue);
}
static function createManyFromTasks($tasks) {
public static function createManyFromTasks($tasks) {
if (empty($tasks)) {
return [];
}
@@ -98,7 +98,7 @@ class Sending {
return $result;
}
static function createFromQueue(SendingQueue $queue) {
public static function createFromQueue(SendingQueue $queue) {
$task = $queue->task()->findOne();
if (!$task) {
return false;
@@ -107,7 +107,7 @@ class Sending {
return self::create($task, $queue);
}
static function getByNewsletterId($newsletter_id) {
public static function getByNewsletterId($newsletter_id) {
$queue = SendingQueue::where('newsletter_id', $newsletter_id)
->orderByDesc('updated_at')
->findOne();
@@ -195,7 +195,7 @@ class Sending {
return $this->updateCount()->getErrors() === false;
}
function updateCount() {
public function updateCount() {
$this->queue->count_processed = ScheduledTaskSubscriber::getProcessedCount($this->task->id);
$this->queue->count_to_process = ScheduledTaskSubscriber::getUnprocessedCount($this->task->id);
$this->queue->count_total = $this->queue->count_processed + $this->queue->count_to_process;
@@ -255,7 +255,7 @@ class Sending {
return in_array($prop, $this->common_fields);
}
static function getScheduledQueues($amount = self::RESULT_BATCH_SIZE) {
public static function getScheduledQueues($amount = self::RESULT_BATCH_SIZE) {
$wp = new WPFunctions();
$tasks = ScheduledTask::tableAlias('tasks')
->select('tasks.*')
@@ -270,7 +270,7 @@ class Sending {
return static::createManyFromTasks($tasks);
}
static function getRunningQueues($amount = self::RESULT_BATCH_SIZE) {
public static function getRunningQueues($amount = self::RESULT_BATCH_SIZE) {
$tasks = ScheduledTask::orderByAsc('priority')
->orderByAsc('updated_at')
->whereNull('deleted_at')

View File

@@ -14,7 +14,7 @@ class State
/**
* @return array
*/
function getCountsPerStatus() {
public function getCountsPerStatus() {
$stats = [
ScheduledTask::STATUS_COMPLETED => 0,
ScheduledTask::STATUS_PAUSED => 0,
@@ -40,7 +40,7 @@ class State
/**
* @return array
*/
function getLatestTasks(
public function getLatestTasks(
$type = null,
$statuses = [
ScheduledTask::STATUS_COMPLETED,

View File

@@ -12,15 +12,15 @@ class Subscribers {
$this->task = $task;
}
function setSubscribers(array $subscriber_ids) {
public function setSubscribers(array $subscriber_ids) {
ScheduledTaskSubscriber::setSubscribers($this->task->id, $subscriber_ids);
}
function getSubscribers() {
public function getSubscribers() {
return ScheduledTaskSubscriber::where('task_id', $this->task->id);
}
function isSubscriberProcessed($subscriber_id) {
public function isSubscriberProcessed($subscriber_id) {
$subscriber = $this->getSubscribers()
->where('subscriber_id', $subscriber_id)
->where('processed', ScheduledTaskSubscriber::STATUS_PROCESSED)
@@ -28,20 +28,20 @@ class Subscribers {
return !empty($subscriber);
}
function removeSubscribers(array $subscribers_to_remove) {
public function removeSubscribers(array $subscribers_to_remove) {
$this->getSubscribers()
->whereIn('subscriber_id', $subscribers_to_remove)
->deleteMany();
$this->checkCompleted();
}
function removeAllSubscribers() {
public function removeAllSubscribers() {
$this->getSubscribers()
->deleteMany();
$this->checkCompleted();
}
function updateProcessedSubscribers(array $processed_subscribers) {
public function updateProcessedSubscribers(array $processed_subscribers) {
if (!empty($processed_subscribers)) {
$this->getSubscribers()
->whereIn('subscriber_id', $processed_subscribers)
@@ -52,7 +52,7 @@ class Subscribers {
$this->checkCompleted();
}
function saveSubscriberError($subcriber_id, $error_message) {
public function saveSubscriberError($subcriber_id, $error_message) {
$this->getSubscribers()
->where('subscriber_id', $subcriber_id)
->findResultSet()

View File

@@ -12,7 +12,7 @@ class BatchIterator implements \Iterator, \Countable {
private $last_processed_id = 0;
private $batch_last_id;
function __construct($task_id, $batch_size) {
public function __construct($task_id, $batch_size) {
if ($task_id <= 0) {
throw new \Exception('Task ID must be greater than zero');
} elseif ($batch_size <= 0) {
@@ -22,11 +22,11 @@ class BatchIterator implements \Iterator, \Countable {
$this->batch_size = (int)$batch_size;
}
function rewind() {
public function rewind() {
$this->last_processed_id = 0;
}
function current() {
public function current() {
$subscribers = $this->getSubscribers()
->orderByAsc('subscriber_id')
->limit($this->batch_size)
@@ -36,19 +36,19 @@ class BatchIterator implements \Iterator, \Countable {
return $subscribers;
}
function key() {
public function key() {
return null;
}
function next() {
public function next() {
$this->last_processed_id = $this->batch_last_id;
}
function valid() {
public function valid() {
return $this->count() > 0;
}
function count() {
public function count() {
return $this->getSubscribers()->count();
}