Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 13 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
| IntegrationCostCenterDTO | |
0.00% |
0 / 13 |
|
0.00% |
0 / 3 |
12 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
| toArray | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
2 | |||
| fromRequest | |
0.00% |
0 / 5 |
|
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 IntegrationCostCenterDTO implements DataTransferObjectInterface |
| 9 | { |
| 10 | public ?string $company_code; |
| 11 | public ?string $cost_center_code; |
| 12 | public ?string $description; |
| 13 | |
| 14 | public function __construct(array $args) |
| 15 | { |
| 16 | $this->company_code = $args['company_code'] ?? ''; |
| 17 | $this->cost_center_code = $args['cost_center_code'] ?? ''; |
| 18 | $this->description = $args['description'] ?? ''; |
| 19 | } |
| 20 | |
| 21 | public function toArray(): array |
| 22 | { |
| 23 | return [ |
| 24 | 'company_code' => $this->company_code, |
| 25 | 'cost_center_code' => $this->cost_center_code, |
| 26 | 'description' => $this->description, |
| 27 | ]; |
| 28 | } |
| 29 | |
| 30 | public static function fromRequest(FormRequest $request): IntegrationCostCenterDTO |
| 31 | { |
| 32 | return new self([ |
| 33 | 'company_code' => $request->validated('company_code'), |
| 34 | 'cost_center_code' => $request->validated('cost_center_code'), |
| 35 | 'description' => $request->validated('description'), |
| 36 | ]); |
| 37 | } |
| 38 | } |