1 | <?php |
||||
2 | declare(strict_types=1); |
||||
3 | /** |
||||
4 | * Copyright (c) Phauthentic (https://github.com/Phauthentic) |
||||
5 | * |
||||
6 | * Licensed under The MIT License |
||||
7 | * For full copyright and license information, please see the LICENSE.txt |
||||
8 | * Redistributions of files must retain the above copyright notice. |
||||
9 | * |
||||
10 | * @copyright Copyright (c) Phauthentic (https://github.com/Phauthentic) |
||||
11 | * @link https://github.com/Phauthentic |
||||
12 | * @license https://opensource.org/licenses/mit-license.php MIT License |
||||
13 | */ |
||||
14 | namespace Phauthentic\Email\Mailer; |
||||
15 | |||||
16 | use Phauthentic\Email\EmailInterface; |
||||
17 | use Psr\Log\LoggerInterface; |
||||
18 | use Psr\Log\LogLevel; |
||||
19 | |||||
20 | /** |
||||
21 | * Doesn't send emails but logs them instead |
||||
22 | */ |
||||
23 | class LogMailer implements MailerInterface |
||||
24 | { |
||||
25 | /** |
||||
26 | * Logger |
||||
27 | * |
||||
28 | * @var \Psr\Log\LoggerInterface |
||||
29 | */ |
||||
30 | protected $Logger; |
||||
31 | |||||
32 | /** |
||||
33 | * Log Level |
||||
34 | * |
||||
35 | * @var string |
||||
36 | */ |
||||
37 | protected $logLevel; |
||||
38 | |||||
39 | /** |
||||
40 | * Constructor |
||||
41 | * |
||||
42 | * @param \Psr\Log\LoggerInterface |
||||
43 | */ |
||||
44 | public function __construct( |
||||
45 | LoggerInterface $logger, |
||||
0 ignored issues
–
show
|
|||||
46 | $logLevel = LogLevel::INFO |
||||
47 | ) { |
||||
48 | $this->Logger; |
||||
49 | $this->logLevel = $logLevel; |
||||
50 | } |
||||
51 | |||||
52 | /** |
||||
53 | * @inheritDoc |
||||
54 | */ |
||||
55 | public function send(EmailInterface $email): bool |
||||
56 | { |
||||
57 | $this->Logger->log($this->logLevel, $email); |
||||
0 ignored issues
–
show
$email of type Phauthentic\Email\EmailInterface is incompatible with the type string expected by parameter $message of Psr\Log\LoggerInterface::log() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
58 | |||||
59 | return true; |
||||
60 | } |
||||
61 | } |
||||
62 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.