• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

FastyBird / accounts-module / 12030623467

26 Nov 2024 12:29PM UTC coverage: 70.389%. Remained the same
12030623467

push

github

actions-user
Added missing package repository (#331)

2370 of 3367 relevant lines covered (70.39%)

40.77 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Documents/Emails/Email.php
1
<?php declare(strict_types = 1);
2

3
/**
4
 * Email.php
5
 *
6
 * @license        More in LICENSE.md
7
 * @copyright      http://www.fastybird.com
8
 * @author         Adam Kadlec <adam.kadlec@fastybird.com>
9
 * @package        FastyBird:AccountsModule!
10
 * @subpackage     Documents
11
 * @since          1.0.0
12
 *
13
 * @date           01.06.22
14
 */
15

16
namespace FastyBird\Module\Accounts\Documents\Emails;
17

18
use FastyBird\Core\Application\Documents as ApplicationDocuments;
19
use FastyBird\Core\Application\ObjectMapper as ApplicationObjectMapper;
20
use FastyBird\Core\Exchange\Documents as ExchangeDocuments;
21
use FastyBird\Library\Metadata\Types as MetadataTypes;
22
use FastyBird\Module\Accounts;
23
use FastyBird\Module\Accounts\Entities;
24
use Orisai\ObjectMapper;
25
use Ramsey\Uuid;
26

27
/**
28
 * Email document
29
 *
30
 * @package        FastyBird:AccountsModule!
31
 * @subpackage     Documents
32
 *
33
 * @author         Adam Kadlec <adam.kadlec@fastybird.com>
34
 */
35
#[ApplicationDocuments\Mapping\Document(entity: Entities\Emails\Email::class)]
36
#[ExchangeDocuments\Mapping\RoutingMap([
37
        Accounts\Constants::MESSAGE_BUS_EMAIL_DOCUMENT_REPORTED_ROUTING_KEY,
38
        Accounts\Constants::MESSAGE_BUS_EMAIL_DOCUMENT_CREATED_ROUTING_KEY,
39
        Accounts\Constants::MESSAGE_BUS_EMAIL_DOCUMENT_UPDATED_ROUTING_KEY,
40
        Accounts\Constants::MESSAGE_BUS_EMAIL_DOCUMENT_DELETED_ROUTING_KEY,
41
])]
42
final readonly class Email implements ApplicationDocuments\Document
43
{
44

45
        public function __construct(
46
                #[ApplicationObjectMapper\Rules\UuidValue()]
47
                private Uuid\UuidInterface $id,
48
                #[ApplicationObjectMapper\Rules\UuidValue()]
49
                private Uuid\UuidInterface $account,
50
                #[ObjectMapper\Rules\StringValue(pattern: '/^[\w\-\.]+@[\w\-\.]+\.+[\w-]{2,63}$/', notEmpty: true)]
51
                private string $address,
52
                #[ObjectMapper\Rules\BoolValue(castBoolLike: true)]
53
                private bool $default = false,
54
                #[ObjectMapper\Rules\BoolValue(castBoolLike: true)]
55
                private bool $verified = false,
56
                #[ObjectMapper\Rules\BoolValue(castBoolLike: true)]
57
                private bool $private = false,
58
                #[ObjectMapper\Rules\BoolValue(castBoolLike: true)]
59
                private bool $public = false,
60
        )
61
        {
62
        }
×
63

64
        public function getId(): Uuid\UuidInterface
65
        {
66
                return $this->id;
×
67
        }
68

69
        public function getAccount(): Uuid\UuidInterface
70
        {
71
                return $this->account;
×
72
        }
73

74
        public function getAddress(): string
75
        {
76
                return $this->address;
×
77
        }
78

79
        public function isDefault(): bool
80
        {
81
                return $this->default;
×
82
        }
83

84
        public function isVerified(): bool
85
        {
86
                return $this->verified;
×
87
        }
88

89
        public function isPrivate(): bool
90
        {
91
                return $this->private;
×
92
        }
93

94
        public function isPublic(): bool
95
        {
96
                return $this->public;
×
97
        }
98

99
        public function getSource(): MetadataTypes\Sources\Source
100
        {
101
                return MetadataTypes\Sources\Module::ACCOUNTS;
×
102
        }
103

104
        public function toArray(): array
105
        {
106
                return [
×
107
                        'id' => $this->getId()->toString(),
×
108
                        'source' => $this->getSource()->value,
×
109
                        'account' => $this->getAccount()->toString(),
×
110
                        'address' => $this->getAddress(),
×
111
                        'default' => $this->isDefault(),
×
112
                        'verified' => $this->isVerified(),
×
113
                        'private' => $this->isPrivate(),
×
114
                        'public' => $this->isPublic(),
×
115
                ];
×
116
        }
117

118
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc