Skip to content

Instantly share code, notes, and snippets.

@adri
Last active September 26, 2018 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adri/b8b51a014d7d4ec89a29ac02d048a7b0 to your computer and use it in GitHub Desktop.
Save adri/b8b51a014d7d4ec89a29ac02d048a7b0 to your computer and use it in GitHub Desktop.
Example PayoutContext for using a Factory
<?php
class PayoutContext
{
/**
* @var PayoutId
*/
public $payoutId;
/**
* @var Payment
*/
public $payment;
public function create(Factory $factory) : Payout
{
return new Payout(
$this->payoutId ?? PayoutId::create(), // random id
$this->payment ?? $factory->payment()
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment