Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 40 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
| IntegrationInvoiceDTO | |
0.00% |
0 / 40 |
|
0.00% |
0 / 3 |
12 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 12 |
|
0.00% |
0 / 1 |
2 | |||
| toArray | |
0.00% |
0 / 14 |
|
0.00% |
0 / 1 |
2 | |||
| fromRequest | |
0.00% |
0 / 14 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Domain\Integration\DTOs; |
| 4 | |
| 5 | use Domain\Shared\Interfaces\DataTransferObjectInterface; |
| 6 | use Illuminate\Foundation\Http\FormRequest; |
| 7 | |
| 8 | class IntegrationInvoiceDTO implements DataTransferObjectInterface |
| 9 | { |
| 10 | public ?string $cgcCpf; |
| 11 | public ?string $chvNel; |
| 12 | public ?string $codEmp; |
| 13 | public ?string $codFil; |
| 14 | public ?string $codFor; |
| 15 | public ?string $codSnf; |
| 16 | public ?string $datEmi; |
| 17 | public ?string $datEnt; |
| 18 | public ?string $datGer; |
| 19 | public ?string $nomFor; |
| 20 | public ?string $numNfc; |
| 21 | public ?string $obsNfc; |
| 22 | |
| 23 | public function __construct(array $args) |
| 24 | { |
| 25 | $this->cgcCpf = $args['cgcCpf'] ?? ''; |
| 26 | $this->chvNel = $args['chvNel'] ?? ''; |
| 27 | $this->codEmp = $args['codEmp'] ?? ''; |
| 28 | $this->codFil = $args['codFil'] ?? ''; |
| 29 | $this->codFor = $args['codFor'] ?? ''; |
| 30 | $this->codSnf = $args['codSnf'] ?? ''; |
| 31 | $this->datEmi = $args['datEmi'] ?? ''; |
| 32 | $this->datEnt = $args['datEnt'] ?? ''; |
| 33 | $this->datGer = $args['datGer'] ?? ''; |
| 34 | $this->nomFor = $args['nomFor'] ?? ''; |
| 35 | $this->numNfc = $args['numNfc'] ?? ''; |
| 36 | $this->obsNfc = $args['obsNfc'] ?? ''; |
| 37 | } |
| 38 | |
| 39 | public function toArray(): array |
| 40 | { |
| 41 | return [ |
| 42 | 'CGCCPF' => $this->cgcCpf, |
| 43 | 'CHVNEL' => $this->chvNel, |
| 44 | 'CODEMP' => $this->codEmp, |
| 45 | 'CODFIL' => $this->codFil, |
| 46 | 'CODFOR' => $this->codFor, |
| 47 | 'CODSNF' => $this->codSnf, |
| 48 | 'DATEMI' => $this->datEmi, |
| 49 | 'DATENT' => $this->datEnt, |
| 50 | 'DATGER' => $this->datGer, |
| 51 | 'NOMFOR' => $this->nomFor, |
| 52 | 'NUMNFC' => $this->numNfc, |
| 53 | 'OBSNFC' => $this->obsNfc, |
| 54 | ]; |
| 55 | } |
| 56 | |
| 57 | public static function fromRequest(FormRequest $request): IntegrationInvoiceDTO |
| 58 | { |
| 59 | return new self([ |
| 60 | 'cgcCpf' => $request->validated('cgcCpf'), |
| 61 | 'chvNel' => $request->validated('chvNel'), |
| 62 | 'codEmp' => $request->validated('codEmp'), |
| 63 | 'codFil' => $request->validated('codFil'), |
| 64 | 'codFor' => $request->validated('codFor'), |
| 65 | 'codSnf' => $request->validated('codSnf'), |
| 66 | 'datEmi' => $request->validated('datEmi'), |
| 67 | 'datEnt' => $request->validated('datEnt'), |
| 68 | 'datGer' => $request->validated('datGer'), |
| 69 | 'nomFor' => $request->validated('nomFor'), |
| 70 | 'numNfc' => $request->validated('numNfc'), |
| 71 | 'obsNfc' => $request->validated('obsNfc'), |
| 72 | ]); |
| 73 | } |
| 74 | |
| 75 | } |