Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
| Total | |
100.00% |
6 / 6 |
|
100.00% |
4 / 4 |
|
100.00% |
4 / 4 |
|
100.00% |
4 / 4 |
CRAP | |
100.00% |
1 / 1 |
| RegistrationRequest | |
100.00% |
6 / 6 |
|
100.00% |
4 / 4 |
|
100.00% |
4 / 4 |
|
100.00% |
4 / 4 |
4 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getEmail | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getUsername | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getPassword | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Auth\Infrastructure\Dto; |
| 4 | |
| 5 | use App\Auth\Application\Command\RegistrationCommand; |
| 6 | use App\Shared\Domain\Exception\ErrorCode; |
| 7 | use Symfony\Component\ObjectMapper\Attribute\Map; |
| 8 | use Symfony\Component\Validator\Constraints as Assert; |
| 9 | |
| 10 | #[Map(target: RegistrationCommand::class)] |
| 11 | readonly class RegistrationRequest |
| 12 | { |
| 13 | #[Assert\Email( |
| 14 | message: 'The email {{ value }} is not a valid email.', |
| 15 | payload: ['code' => ErrorCode::INVALID_EMAIL] |
| 16 | )] |
| 17 | private readonly string $email; |
| 18 | |
| 19 | #[Assert\Regex( |
| 20 | pattern: '/[^a-zA-Z0-9_\-]/', |
| 21 | message: "The username can only include alphanumeric characters, underscores, and dashes.", |
| 22 | match: false |
| 23 | )] |
| 24 | private readonly string $username; |
| 25 | |
| 26 | #[Assert\PasswordStrength] |
| 27 | private readonly string $password; |
| 28 | public function __construct( |
| 29 | string $email, |
| 30 | string $username, |
| 31 | string $password |
| 32 | ) { |
| 33 | $this->email = $email; |
| 34 | $this->username = $username; |
| 35 | $this->password = $password; |
| 36 | } |
| 37 | |
| 38 | public function getEmail(): string |
| 39 | { |
| 40 | return $this->email; |
| 41 | } |
| 42 | public function getUsername(): string |
| 43 | { |
| 44 | return $this->username; |
| 45 | } |
| 46 | |
| 47 | public function getPassword(): string |
| 48 | { |
| 49 | return $this->password; |
| 50 | } |
| 51 | } |
Below are the source code lines that represent each code path as identified by Xdebug. Please note a path is not
necessarily coterminous with a line, a line may contain multiple paths and therefore show up more than once.
Please also be aware that some paths may include implicit rather than explicit branches, e.g. an if statement
always has an else as part of its logical flow even if you didn't write one.
| 28 | public function __construct( |
| 29 | string $email, |
| 30 | string $username, |
| 31 | string $password |
| 32 | ) { |
| 33 | $this->email = $email; |
| 34 | $this->username = $username; |
| 35 | $this->password = $password; |
| 36 | } |
| 40 | return $this->email; |
| 41 | } |
| 49 | return $this->password; |
| 50 | } |
| 44 | return $this->username; |
| 45 | } |
| 3 | namespace App\Auth\Infrastructure\Dto; |
| 4 | |
| 5 | use App\Auth\Application\Command\RegistrationCommand; |
| 6 | use App\Shared\Domain\Exception\ErrorCode; |
| 7 | use Symfony\Component\ObjectMapper\Attribute\Map; |
| 8 | use Symfony\Component\Validator\Constraints as Assert; |
| 9 | |
| 10 | #[Map(target: RegistrationCommand::class)] |
| 11 | readonly class RegistrationRequest |
| 12 | { |
| 13 | #[Assert\Email( |
| 14 | message: 'The email {{ value }} is not a valid email.', |
| 15 | payload: ['code' => ErrorCode::INVALID_EMAIL] |
| 16 | )] |
| 17 | private readonly string $email; |
| 18 | |
| 19 | #[Assert\Regex( |
| 20 | pattern: '/[^a-zA-Z0-9_\-]/', |
| 21 | message: "The username can only include alphanumeric characters, underscores, and dashes.", |
| 22 | match: false |
| 23 | )] |
| 24 | private readonly string $username; |
| 25 | |
| 26 | #[Assert\PasswordStrength] |
| 27 | private readonly string $password; |
| 28 | public function __construct( |
| 29 | string $email, |
| 30 | string $username, |
| 31 | string $password |
| 32 | ) { |
| 33 | $this->email = $email; |
| 34 | $this->username = $username; |
| 35 | $this->password = $password; |
| 36 | } |
| 37 | |
| 38 | public function getEmail(): string |
| 39 | { |
| 40 | return $this->email; |
| 41 | } |
| 42 | public function getUsername(): string |
| 43 | { |
| 44 | return $this->username; |
| 45 | } |
| 46 | |
| 47 | public function getPassword(): string |
| 48 | { |
| 49 | return $this->password; |
| 50 | } |