Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
EmailAddress
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
2
1<?php
2
3declare(strict_types=1);
4
5namespace PeServer\Core\Mail;
6
7use PeServer\Core\Text;
8
9/**
10 * メールアドレス管理。
11 */
12readonly class EmailAddress
13{
14    #region variable
15
16    /**
17     * 名前。
18     */
19    public string $name;
20
21    #endregion
22
23    /**
24     * 生成。
25     *
26     * @param string $address メールアドレス。
27     * @param string|null $name 名前。
28     */
29    public function __construct(
30        public string $address,
31        ?string $name = null
32    ) {
33        if (Text::isNullOrWhiteSpace($name)) {
34            $this->name = '';
35        } else {
36            $this->name = $name;
37        }
38    }
39}