Lines
0.00%
0 / 18
Functions and Methods
0.00%
0 / 1
Classes and Traits
0.00%
0 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| MailProcessor | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | 0.00% | 0 / 1 | |||
| __construct | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | /** | |
| 4 | * | |
| 5 | * @package Zmsmessaging | |
| 6 | * | |
| 7 | */ | |
| 8 | ||
| 9 | namespace BO\Zmsmessaging; | |
| 10 | ||
| 11 | use BO\Zmsmessaging\BaseController; | |
| 12 | ||
| 13 | require __DIR__ . '/../../vendor/autoload.php'; | |
| 14 | require __DIR__ . '/../../bootstrap.php'; | |
| 15 | ||
| 16 | class MailProcessor extends Mail | |
| 17 | { | |
| 18 | public function __construct(mixed $verbose = false, mixed $maxRunTime = 50) | |
| 19 | { | |
| 20 | parent::__construct($verbose, $maxRunTime); | |
| 21 | } | |
| 22 | } | |
| 23 | ||
| 24 | if ($argc > 2) { | |
| 25 | $encodedIds = $argv[1]; | |
| 26 | $action = $argv[2]; | |
| 27 | $decodedAction = json_decode($action, true); | |
| 28 | if (json_last_error() === JSON_ERROR_NONE) { | |
| 29 | $action = $decodedAction; | |
| 30 | } else { | |
| 31 | $action = $action === 'false' ? false : ($action === 'true' ? true : $action); | |
| 32 | } | |
| 33 | $processor = new MailProcessor(); | |
| 34 | $ids = json_decode(base64_decode($encodedIds), true); | |
| 35 | try { | |
| 36 | $results = $processor->sendQueueItems($action, $ids); | |
| 37 | foreach ($results as $result) { | |
| 38 | if (isset($result['errorInfo'])) { | |
| 39 | $processor->log("Error processing mail item: " . $result['errorInfo']); | |
| 40 | } | |
| 41 | } | |
| 42 | } catch (\Exception $exception) { | |
| 43 | $processor->log("Error processing batch: " . $exception->getMessage()); | |
| 44 | } | |
| 45 | } |