Total Complexity | 5 |
Total Lines | 45 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
16 | class InstallmentWasFinished extends AbstractEvent implements \JsonSerializable |
||
17 | { |
||
18 | /** |
||
19 | * @var ChargeInterface |
||
20 | */ |
||
21 | private $charge; |
||
22 | /** |
||
23 | * @var \DateTimeImmutable |
||
24 | */ |
||
25 | private $time; |
||
26 | |||
27 | private function __construct(ChargeInterface $charge, \DateTimeImmutable $time) |
||
28 | { |
||
29 | $this->charge = $charge; |
||
30 | $this->time = $time; |
||
31 | } |
||
32 | |||
33 | public static function onCharge(ChargeInterface $charge, \DateTimeImmutable $time): self |
||
34 | { |
||
35 | return new self($charge, $time); |
||
36 | } |
||
37 | |||
38 | public function getCharge(): ChargeInterface |
||
39 | { |
||
40 | return $this->charge; |
||
41 | } |
||
42 | |||
43 | public function getTime(): \DateTimeImmutable |
||
44 | { |
||
45 | return $this->time; |
||
46 | } |
||
47 | |||
48 | /** |
||
49 | * Specify data which should be serialized to JSON |
||
50 | * |
||
51 | * @link https://php.net/manual/en/jsonserializable.jsonserialize.php |
||
52 | * @return mixed data which can be serialized by <b>json_encode</b>, |
||
53 | * which is a value of any type other than a resource |
||
54 | * @since 5.4.0 |
||
55 | */ |
||
56 | public function jsonSerialize(): array |
||
61 | ]; |
||
62 | } |
||
63 | } |
||
64 |