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