| Total Complexity | 11 |
| Total Lines | 106 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 7 | class MailJob extends AbstractMailObject implements MailJobInterface |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * @var mixed |
||
| 11 | */ |
||
| 12 | private $id; |
||
| 13 | /** |
||
| 14 | * @var MailMessage|string |
||
| 15 | */ |
||
| 16 | private $message; |
||
| 17 | /** |
||
| 18 | * @var int number of attempts. Every time a mail fails to be sent, the number of attempts could be incremented. |
||
| 19 | * |
||
| 20 | * @see `incrementAttempt()` |
||
| 21 | */ |
||
| 22 | private $attempt = 0; |
||
| 23 | /** |
||
| 24 | * @var bool whether the job has been completed |
||
| 25 | */ |
||
| 26 | private $completed = false; |
||
| 27 | /** |
||
| 28 | * {@inheritdoc} |
||
| 29 | */ |
||
| 30 | 19 | public function __construct(array $config = []) |
|
| 31 | { |
||
| 32 | 19 | parent::__construct($config); |
|
| 33 | 19 | } |
|
| 34 | |||
| 35 | /** |
||
| 36 | * @return bool |
||
| 37 | */ |
||
| 38 | 15 | public function isNewRecord() |
|
| 39 | { |
||
| 40 | 15 | return $this->getId() === null; |
|
| 41 | } |
||
| 42 | |||
| 43 | /** |
||
| 44 | * @return mixed |
||
| 45 | */ |
||
| 46 | 18 | public function getId() |
|
| 49 | } |
||
| 50 | |||
| 51 | /** |
||
| 52 | * @param mixed $id |
||
| 53 | */ |
||
| 54 | 14 | public function setId($id) |
|
| 55 | { |
||
| 56 | 14 | $this->id = $id; |
|
| 57 | 14 | } |
|
| 58 | |||
| 59 | /** |
||
| 60 | * @return MailMessage|string |
||
| 61 | */ |
||
| 62 | 16 | public function getMessage() |
|
| 63 | { |
||
| 64 | 16 | return $this->message; |
|
| 65 | } |
||
| 66 | |||
| 67 | /** |
||
| 68 | * @param MailMessage|string $message |
||
| 69 | */ |
||
| 70 | 19 | public function setMessage($message) |
|
| 71 | { |
||
| 72 | 19 | $this->message = $message; |
|
| 73 | 19 | } |
|
| 74 | |||
| 75 | /** |
||
| 76 | * @return int |
||
| 77 | */ |
||
| 78 | 15 | public function getAttempt() |
|
| 79 | { |
||
| 80 | 15 | return $this->attempt; |
|
| 81 | } |
||
| 82 | |||
| 83 | /** |
||
| 84 | * @param $attempt |
||
| 85 | */ |
||
| 86 | 14 | public function setAttempt($attempt) |
|
| 87 | { |
||
| 88 | 14 | $this->attempt = $attempt; |
|
| 89 | 14 | } |
|
| 90 | |||
| 91 | /** |
||
| 92 | * Increments attempt by one. |
||
| 93 | */ |
||
| 94 | 1 | public function incrementAttempt() |
|
| 97 | 1 | } |
|
| 98 | |||
| 99 | /** |
||
| 100 | * @return bool |
||
| 101 | */ |
||
| 102 | 7 | public function markAsCompleted() |
|
| 105 | } |
||
| 106 | |||
| 107 | /** |
||
| 108 | * @return bool |
||
| 109 | */ |
||
| 110 | 10 | public function isCompleted() |
|
| 113 | } |
||
| 114 | } |
||
| 115 |