Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
10 / 10 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
| SeniorAuthenticationDTO | |
100.00% |
10 / 10 |
|
100.00% |
3 / 3 |
3 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| toArray | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
| fromRequest | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Domain\User\DTOs; |
| 4 | |
| 5 | use Domain\Shared\Interfaces\DataTransferObjectInterface; |
| 6 | use Illuminate\Foundation\Http\FormRequest; |
| 7 | |
| 8 | readonly final class SeniorAuthenticationDTO implements DataTransferObjectInterface |
| 9 | { |
| 10 | private ?string $user; |
| 11 | private ?string $password; |
| 12 | |
| 13 | public function __construct(array $args) |
| 14 | { |
| 15 | $this->user = $args['user']; |
| 16 | $this->password = $args['password']; |
| 17 | } |
| 18 | |
| 19 | public function toArray(): array |
| 20 | { |
| 21 | return [ |
| 22 | 'user' => $this->user, |
| 23 | 'password' => $this->password, |
| 24 | ]; |
| 25 | } |
| 26 | |
| 27 | public static function fromRequest(FormRequest $request): self |
| 28 | { |
| 29 | return new self([ |
| 30 | 'user' => $request->validated('user'), |
| 31 | 'password' => $request->validated('password'), |
| 32 | ]); |
| 33 | } |
| 34 | } |