Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 25
0.00% covered (danger)
0.00%
0 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
IntegrationPurchaseOrderDTO
0.00% covered (danger)
0.00%
0 / 25
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 / 7
0.00% covered (danger)
0.00%
0 / 1
2
 toArray
0.00% covered (danger)
0.00%
0 / 9
0.00% covered (danger)
0.00%
0 / 1
2
 fromRequest
0.00% covered (danger)
0.00%
0 / 9
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace Domain\Integration\DTOs;
4
5use Domain\Shared\Interfaces\DataTransferObjectInterface;
6use Illuminate\Foundation\Http\FormRequest;
7
8class IntegrationPurchaseOrderDTO implements DataTransferObjectInterface
9{
10    public string $codEmp;
11    public string $codFil;
12    public string $codGre;
13    public string $datEmi;
14    public string $datGer;
15    public string $numOcp;
16    public string $obsOcp;
17
18    public function __construct(array $args)
19    {
20        $this->codEmp = $args['codEmp'];
21        $this->codFil = $args['codFil'];
22        $this->codGre = $args['codGre'];
23        $this->datEmi = $args['datEmi'];
24        $this->datGer = $args['datGer'];
25        $this->numOcp = $args['numOcp'];
26        $this->obsOcp = $args['obsOcp'];
27    }
28
29    public function toArray(): array
30    {
31        return [
32            'CODEMP' => $this->codEmp,
33            'CODFIL' => $this->codFil,
34            'CODGRE' => $this->codGre,
35            'DATEMI' => $this->datEmi,
36            'DATGER' => $this->datGer,
37            'NUMOCP' => $this->numOcp,
38            'OBSOCP' => $this->obsOcp,
39        ];
40    }
41
42    public static function fromRequest(FormRequest $request): IntegrationPurchaseOrderDTO
43    {
44        return new self([
45            'codEmp' => $request->validated('codEmp'),
46            'codFil' => $request->validated('codFil'),
47            'codGre' => $request->validated('codGre'),
48            'datEmi' => $request->validated('datEmi'),
49            'datGer' => $request->validated('datGer'),
50            'numOcp' => $request->validated('numOcp'),
51            'obsOcp' => $request->validated('obsOcp'),
52        ]);
53    }
54
55}