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
FundCashflowRequestData
0.00% covered (danger)
0.00%
0 / 25
0.00% covered (danger)
0.00%
0 / 3
42
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 fromRow
0.00% covered (danger)
0.00%
0 / 12
0.00% covered (danger)
0.00%
0 / 1
20
 toArray
0.00% covered (danger)
0.00%
0 / 12
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3declare(strict_types=1);
4
5namespace App\Domain\Funds\Data;
6
7final readonly class FundCashflowRequestData
8{
9    public function __construct(
10        public string $id,
11        public int $userId,
12        public string $fundId,
13        public string $requestType,
14        public string $amount,
15        public string $status,
16        public ?string $wireReference,
17        public ?string $reason,
18        public ?string $notes,
19        public string $createdAt,
20    ) {}
21
22    /**
23     * @param array<string, mixed> $row
24     */
25    public static function fromRow(array $row): self
26    {
27        return new self(
28            id: (string)$row['id'],
29            userId: (int)$row['userId'],
30            fundId: (string)$row['fundId'],
31            requestType: (string)$row['requestType'],
32            amount: (string)$row['amount'],
33            status: (string)$row['status'],
34            wireReference: isset($row['wireReference']) ? (string)$row['wireReference'] : null,
35            reason: isset($row['reason']) ? (string)$row['reason'] : null,
36            notes: isset($row['notes']) ? (string)$row['notes'] : null,
37            createdAt: (string)$row['createdAt'],
38        );
39    }
40
41    /**
42     * @return array<string, int|string|null>
43     */
44    public function toArray(): array
45    {
46        return [
47            'id' => $this->id,
48            'userId' => $this->userId,
49            'fundId' => $this->fundId,
50            'requestType' => $this->requestType,
51            'amount' => $this->amount,
52            'status' => $this->status,
53            'wireReference' => $this->wireReference,
54            'reason' => $this->reason,
55            'notes' => $this->notes,
56            'createdAt' => $this->createdAt,
57        ];
58    }
59}
60