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