Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 13
0.00% covered (danger)
0.00%
0 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
CustomerSearchDTO
0.00% covered (danger)
0.00%
0 / 13
0.00% covered (danger)
0.00%
0 / 3
12
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 toArray
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 1
2
 fromRequest
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace Domain\Customer\DTOs;
4
5use Domain\Shared\Interfaces\DataTransferObjectInterface;
6use Illuminate\Foundation\Http\FormRequest;
7
8readonly final class CustomerSearchDTO implements DataTransferObjectInterface
9{
10    public ?string $description;
11    public ?int $id;
12    public ?string $integrationCode;
13
14
15    public function __construct(array $args)
16    {
17        $this->description = $args['description'] ?? null;
18        $this->id = $args['id'] ?? null;
19        $this->integrationCode = $args['integration_code'] ?? null;
20    }
21
22    public function toArray(): array
23    {
24        return [
25            'description' => $this->description,
26            'id' => $this->id,
27            'integration_code' => $this->integrationCode,
28        ];
29    }
30
31    public static function fromRequest(FormRequest $request): CustomerSearchDTO
32    {
33        return new self([
34            'description' => $request->validated('description'),
35            'id' => $request->validated('id'),
36            'integration_code' => $request->validated('integration_code'),
37        ]);
38    }
39}