Passed
Pull Request — developer (#15357)
by Arkadiusz
29:04 queued 07:17
created

CheckErrorMail::process()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 8
rs 10
cc 2
nc 2
nop 0
1
<?php
2
3
/**
4
 * Check errors while sending the message file.
5
 *
6
 * @package App
7
 *
8
 * @copyright YetiForce Sp. z o.o
9
 * @license   YetiForce Public License 4.0 (licenses/LicenseEN.txt or yetiforce.com)
10
 * @author    Arkadiusz Sołek <[email protected]>
11
 */
12
13
namespace App\SystemWarnings\Mail;
14
15
use DateTime;
16
17
/**
18
 * Check for errors while sending the message class.
19
 */
20
class CheckErrorMail extends \App\SystemWarnings\Template
21
{
22
	protected $statusValue = 0;
23
	/** @var string Modal header title */
24
	protected $title = 'LBL_CHECK_ERROR_MAIL';
25
26
	/**
27
	 * Checks for suspended email accounts.
28
	 *
29
	 * @return void
30
	 */
31
	public function process(): void
32
	{
33
		$data = (new \App\Db\Query())->from('l_yf_mail')->where(['>=', 'date', (new DateTime(date('Y-m-d H:i:s')))->modify('-24 hours')->format('Y-m-d H:i:s')])->all();
34
		if (!$data) {
35
			$this->status = 1;
36
		} else {
37
			$this->status = 0;
38
			$this->description = \App\Language::translateArgs('LBL_CHECK_ERROR_MAIL_DESC', 'Settings:SystemWarnings', \count($data));
39
40
		}
41
	}
42
}
43