52 - Avoiding Service Classes with Method Injection

This commit is contained in:
Adam Wathan
2016-12-16 08:31:01 -05:00
parent cf2444da45
commit 990f873e0c
4 changed files with 8 additions and 36 deletions

View File

@@ -28,8 +28,10 @@ class Reservation
return $this->email;
}
public function complete()
public function complete($paymentGateway, $paymentToken)
{
$paymentGateway->charge($this->totalCost(), $paymentToken);
return Order::forTickets($this->tickets(), $this->email(), $this->totalCost());
}