Files
piratepoet/lib/Cron/Workers/AuthorizedSendingEmailsCheck.php
Rodrigo Primo 963da3bf16 Refactor the method processTaskStrategy() of some SimpleWorker child classes
This commit refactors the method processTaskStrategy() of some
SimpleWorker child classes to use Doctrine instead of Paris. In this
commit are included all the classes that it was only necessary to change
the method signature as they were receiving a ScheduledTask object as
the first parameter but didn't use it. Now they receive a
ScheduledTaskEntity object as the first param.

[MAILPOET-3843]
2021-10-05 13:21:53 +02:00

32 lines
869 B
PHP

<?php
namespace MailPoet\Cron\Workers;
use MailPoet\Entities\ScheduledTaskEntity;
use MailPoet\Services\AuthorizedEmailsController;
use MailPoet\Services\Bridge;
class AuthorizedSendingEmailsCheck extends SimpleWorker {
const TASK_TYPE = 'authorized_email_addresses_check';
const AUTOMATIC_SCHEDULING = false;
/** @var AuthorizedEmailsController */
private $authorizedEmailsController;
public function __construct(
AuthorizedEmailsController $authorizedEmailsController
) {
$this->authorizedEmailsController = $authorizedEmailsController;
parent::__construct();
}
public function checkProcessingRequirements() {
return Bridge::isMPSendingServiceEnabled();
}
public function processTaskStrategy(ScheduledTaskEntity $task, $timer) {
$this->authorizedEmailsController->checkAuthorizedEmailAddresses();
return true;
}
}