Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
20 / 20 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| InvestorData | |
100.00% |
20 / 20 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| fromRow | |
100.00% |
19 / 19 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace App\Domain\Investor\Data; |
| 6 | |
| 7 | use App\Support\Row; |
| 8 | |
| 9 | final readonly class InvestorData |
| 10 | { |
| 11 | public function __construct( |
| 12 | public int $investorId, |
| 13 | public string $firstName, |
| 14 | public string $lastName, |
| 15 | public string $email, |
| 16 | public ?string $phone, |
| 17 | public string $dateOfBirth, |
| 18 | public ?string $ssnEncrypted, |
| 19 | public ?string $addressLine1, |
| 20 | public ?string $addressLine2, |
| 21 | public ?string $city, |
| 22 | public ?string $state, |
| 23 | public ?string $zipCode, |
| 24 | public string $country, |
| 25 | public string $kycStatus, |
| 26 | public string $status, |
| 27 | public string $createdAt, |
| 28 | public ?string $updatedAt, |
| 29 | ) {} |
| 30 | |
| 31 | /** |
| 32 | * @param array<mixed> $data |
| 33 | */ |
| 34 | public static function fromRow(array $data): self |
| 35 | { |
| 36 | return new self( |
| 37 | investorId: Row::int($data, 'investorId'), |
| 38 | firstName: Row::string($data, 'firstName'), |
| 39 | lastName: Row::string($data, 'lastName'), |
| 40 | email: Row::string($data, 'email'), |
| 41 | phone: Row::nullableString($data, 'phone'), |
| 42 | dateOfBirth: Row::string($data, 'dateOfBirth'), |
| 43 | ssnEncrypted: Row::nullableString($data, 'ssnEncrypted'), |
| 44 | addressLine1: Row::nullableString($data, 'addressLine1'), |
| 45 | addressLine2: Row::nullableString($data, 'addressLine2'), |
| 46 | city: Row::nullableString($data, 'city'), |
| 47 | state: Row::nullableString($data, 'state'), |
| 48 | zipCode: Row::nullableString($data, 'zipCode'), |
| 49 | country: Row::nullableString($data, 'country') ?? 'USA', |
| 50 | kycStatus: Row::nullableString($data, 'kycStatus') ?? 'pending', |
| 51 | status: Row::nullableString($data, 'status') ?? 'active', |
| 52 | createdAt: Row::string($data, 'createdAt'), |
| 53 | updatedAt: Row::nullableString($data, 'updatedAt'), |
| 54 | ); |
| 55 | } |
| 56 | } |