Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
| Total | |
100.00% |
3 / 3 |
|
100.00% |
3 / 3 |
|
100.00% |
3 / 3 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
| ContactRequest | |
100.00% |
3 / 3 |
|
100.00% |
3 / 3 |
|
100.00% |
3 / 3 |
|
100.00% |
3 / 3 |
3 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getSenderEmail | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getContent | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Dto\Request; |
| 4 | |
| 5 | use App\Exception\ValidationErrorMessage; |
| 6 | use Symfony\Component\Validator\Constraints as Assert; |
| 7 | |
| 8 | /** |
| 9 | * @author Wilhelm Zwertvaegher |
| 10 | */ |
| 11 | readonly class ContactRequest |
| 12 | { |
| 13 | public function __construct( |
| 14 | #[Assert\Email(message: ValidationErrorMessage::INVALID_EMAIL)] |
| 15 | #[Assert\NoSuspiciousCharacters] |
| 16 | private string $senderEmail, |
| 17 | #[Assert\NotBlank( |
| 18 | message: ValidationErrorMessage::FIELD_CANNOT_BE_EMPTY, |
| 19 | )] |
| 20 | #[Assert\Regex( |
| 21 | pattern: '/<[^>]+>/', |
| 22 | message: ValidationErrorMessage::FIELD_CANNOT_CONTAIN_HTML, |
| 23 | match: false |
| 24 | )] |
| 25 | private string $content, |
| 26 | ) { |
| 27 | } |
| 28 | |
| 29 | public function getSenderEmail(): string |
| 30 | { |
| 31 | return $this->senderEmail; |
| 32 | } |
| 33 | |
| 34 | public function getContent(): string |
| 35 | { |
| 36 | return $this->content; |
| 37 | } |
| 38 | } |