Last active
September 26, 2018 14:26
-
-
Save adri/b8b51a014d7d4ec89a29ac02d048a7b0 to your computer and use it in GitHub Desktop.
Example PayoutContext for using a Factory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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