예제 #1
0
파일: Account.php 프로젝트: potfur/journal
 public function withdraw(Withdraw $withdraw)
 {
     if ($this->balance < $withdraw->getAmount()) {
         throw new \InvalidArgumentException('Trying to withdraw greater amount than current balance');
     }
     $this->applyMoneyWereWithdrawnEvent($this->record(new MoneyWereWithdrawnEvent($this->number, $withdraw)));
 }
예제 #2
0
 public function __construct(AccountNumber $accountNumber, Withdraw $withdraw)
 {
     $this->accountNumber = (string) $accountNumber;
     $this->transaction = (string) $withdraw->getTransaction();
     $this->amount = (int) $withdraw->getAmount();
     $this->identifier = uniqid();
     $this->recordedOn = microtime(true);
 }