Issues (1251)

src/Valkyrja/Mail/LogMailer.php (1 issue)

Labels
Severity
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Valkyrja Framework package.
7
 *
8
 * (c) Melech Mizrachi <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Valkyrja\Mail;
15
16
use JsonException;
17
use Override;
0 ignored issues
show
The type Override was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
18
use Valkyrja\Log\Contract\Logger;
19
use Valkyrja\Mail\Contract\Mailer as Contract;
20
use Valkyrja\Mail\Data\Contract\Message;
21
use Valkyrja\Type\BuiltIn\Support\Arr;
22
23
/**
24
 * Class LogMailer.
25
 *
26
 * @author Melech Mizrachi
27
 */
28
class LogMailer implements Contract
29
{
30
    /**
31
     * LogMailer constructor.
32
     */
33
    public function __construct(
34
        protected Logger $logger
35
    ) {
36
    }
37
38
    /**
39
     * @inheritDoc
40
     *
41
     * @throws JsonException
42
     */
43
    #[Override]
44
    public function send(Message $message): void
45
    {
46
        $this->logger->info(static::class . ' Send');
47
        $this->logger->info('From Name:');
48
        $this->logger->info($message->getFromName());
49
        $this->logger->info('From Email:');
50
        $this->logger->info($message->getFromEmail());
51
        $this->logger->info('Recipients:');
52
        $this->logger->info(Arr::toString($message->getRecipients()));
53
        $this->logger->info('ReplyTo Recipients:');
54
        $this->logger->info(Arr::toString($message->getReplyToRecipients()));
55
        $this->logger->info('Copy Recipients:');
56
        $this->logger->info(Arr::toString($message->getCopyRecipients()));
57
        $this->logger->info('Blind Copy Recipients:');
58
        $this->logger->info(Arr::toString($message->getBlindCopyRecipients()));
59
        $this->logger->info('Attachments:');
60
        $this->logger->info(Arr::toString($message->getAttachments()));
61
        $this->logger->info('Subject:');
62
        $this->logger->info($message->getSubject());
63
        $this->logger->info('Body:');
64
        $this->logger->info($message->getBody());
65
        $this->logger->info('Plain Body:');
66
        $this->logger->info($message->getPlainBody() ?? '');
67
        $this->logger->info('Is HTML:');
68
        $this->logger->info((string) $message->isHtml());
69
    }
70
}
71