public function newDeposit($money, Deposit $deposit, Bank $bank) { if ($this->money >= $money) { $this->deposits[] = $deposit; $this->getDeposits()[count($this->getDeposits() - 1)]->paymentCalc($money); //$deposit->paymentCalc($money); $this->money -= $money; $bank->getDeposit($money); } else { throw new Exception('Not enough money.'); } }