Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
57.14% |
4 / 7 |
|
66.67% |
2 / 3 |
CRAP | |
0.00% |
0 / 1 |
| AccessLevelByEmailDTO | |
57.14% |
4 / 7 |
|
66.67% |
2 / 3 |
3.71 | |
0.00% |
0 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| toArray | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
| fromRequest | |
100.00% |
3 / 3 |
|
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 AccessLevelByEmailDTO implements DataTransferObjectInterface |
| 9 | { |
| 10 | public string $email; |
| 11 | |
| 12 | public function __construct(array $args) |
| 13 | { |
| 14 | $this->email = $args['email']; |
| 15 | } |
| 16 | |
| 17 | public function toArray(): array |
| 18 | { |
| 19 | return [ |
| 20 | 'email' => $this->email |
| 21 | ]; |
| 22 | } |
| 23 | |
| 24 | public static function fromRequest(FormRequest $request): AccessLevelByEmailDTO |
| 25 | { |
| 26 | return new self([ |
| 27 | 'email' => $request->validated('email') |
| 28 | ]); |
| 29 | } |
| 30 | } |