amount = $amount; $this->currency = $currency; } public static function of(MoneyInterface $moneyInterface): self { $money = new self( $moneyInterface->getAmount(), $moneyInterface->getCurrency(), ); $money->conversion = $moneyInterface->getConversion()?->toArray(); return $money; } public function getAmount(): int { return $this->amount; } public function getCurrency(): string { return $this->currency; } public function getConversion(): ?Conversion { return $this->conversion ? Conversion::fromArray($this->conversion) : null; } }