Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
60.00% covered (warning)
60.00%
6 / 10
66.67% covered (warning)
66.67%
2 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
IntegrationFamilyDTO
60.00% covered (warning)
60.00%
6 / 10
66.67% covered (warning)
66.67%
2 / 3
3.58
0.00% covered (danger)
0.00%
0 / 1
 __construct
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 toArray
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
 fromRequest
0.00% covered (danger)
0.00%
0 / 4
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 IntegrationFamilyDTO implements DataTransferObjectInterface
9{
10    public ?string $integrationCode;
11    public string $integrationCompany;
12
13
14    public function __construct(array $args)
15    {
16        $this->integrationCode = $args['integration_code'] ?? null;
17        $this->integrationCompany = $args['integration_company'];
18    }
19
20    public function toArray(): array
21    {
22        return [
23            'integration_code' => $this->integrationCode,
24            'integration_company' => $this->integrationCompany,
25        ];
26    }
27
28    public static function fromRequest(FormRequest $request): IntegrationFamilyDTO
29    {
30        return new self([
31            'integration_code' => $request->validated('integration_code'),
32            'integration_company' => $request->validated('integration_company'),
33        ]);
34    }
35
36}