fromAccount = $fromAC; $this->fromCostCenter = $fromCC; $this->toAccount = $toAC; $this->toCostCenter = $toCC; } public function getFromAccount() : int { return $this->fromAccount; } public function getFromCostCenter() : int { return $this->fromCostCenter; } public function distribute(AccountValue $value) : AccountValue { if($value->getAccount() !== $this->fromAccount) { throw new \Exception('Bad account.'); } if($value->getCostCenter() !== $this->fromCostCenter) { throw new \Exception('Bad costcenter.'); } return new AccountValue($this->toAccount, $this->toCostCenter, $value->getDate(), $value->getValue() * $this->percentage); } }