Skip to content

Instantly share code, notes, and snippets.

@young-steveo
Last active June 20, 2018 19:24
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 young-steveo/e6771bdcf02590aef8d058c2f7080d71 to your computer and use it in GitHub Desktop.
Save young-steveo/e6771bdcf02590aef8d058c2f7080d71 to your computer and use it in GitHub Desktop.
Array Oriented Programming - Refined Transaction
<?php
final class Payment {
public function subscribe(PostParams $data) : Transaction {
$transaction = Transaction::fromPost($data);
$model = new TransactionModel();
$model->create($transaction);
$processor = $model->getProcessor($transaction); // a Processor object
$model->process($processor, $transaction); // status is encapsulated elsewhere.
return $transaction->sanitized();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment