Passed
Push — 6.4 ( b2f05b...7c0c3d )
by Christian
12:48 queued 13s
created

Mail   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 15
dl 0
loc 57
rs 10
c 1
b 0
f 0
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getAttachmentUrls() 0 3 1
A getMailAttachmentsConfig() 0 3 1
A setMailAttachmentsConfig() 0 5 1
A addAttachmentUrl() 0 5 1
A __serialize() 0 8 1
A __unserialize() 0 5 1
1
<?php declare(strict_types=1);
2
3
namespace Shopware\Core\Content\Mail\Service;
4
5
use Symfony\Component\Mime\Email;
6
7
class Mail extends Email
8
{
9
    private ?MailAttachmentsConfig $mailAttachmentsConfig = null;
10
11
    /**
12
     * @var string[]
13
     */
14
    private array $attachmentUrls = [];
15
16
    /**
17
     * @return mixed[]
18
     */
19
    public function __serialize(): array
20
    {
21
        $data = parent::__serialize();
22
23
        $data[] = $this->mailAttachmentsConfig;
24
        $data[] = $this->attachmentUrls;
25
26
        return $data;
27
    }
28
29
    /**
30
     * @param mixed[] $data
31
     */
32
    public function __unserialize(array $data): void
33
    {
34
        [$this->mailAttachmentsConfig, $this->attachmentUrls] = array_splice($data, -2, 2);
35
36
        parent::__unserialize($data);
37
    }
38
39
    public function getMailAttachmentsConfig(): ?MailAttachmentsConfig
40
    {
41
        return $this->mailAttachmentsConfig;
42
    }
43
44
    public function setMailAttachmentsConfig(?MailAttachmentsConfig $mailAttachmentsConfig): self
45
    {
46
        $this->mailAttachmentsConfig = $mailAttachmentsConfig;
47
48
        return $this;
49
    }
50
51
    /**
52
     * @return string[]
53
     */
54
    public function getAttachmentUrls(): array
55
    {
56
        return $this->attachmentUrls;
57
    }
58
59
    public function addAttachmentUrl(string $url): self
60
    {
61
        $this->attachmentUrls[] = $url;
62
63
        return $this;
64
    }
65
}
66