Skip to content

Instantly share code, notes, and snippets.

@aguimaraes
Last active June 3, 2017 19:14
Show Gist options
  • Save aguimaraes/1af92d1d70b6c72ac03c78ff4f53e0a0 to your computer and use it in GitHub Desktop.
Save aguimaraes/1af92d1d70b6c72ac03c78ff4f53e0a0 to your computer and use it in GitHub Desktop.
<?php
namespace App\Domain;
class Checkout
{
private $orderValidation;
private $orderRepo;
public function __construct(OrderValidation $orderValidation, OrderRepository $orderRepo)
{
$this->orderValidation = $orderValidation;
$this->orderRepo = $orderRepo;
}
public function saveOrder(Order $order): Order
{
$this->orderValidation->validate($order);
return $this->orderRepo->save($order);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment