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