Skip to content

Instantly share code, notes, and snippets.

@geomagilles
Last active July 21, 2018 16:31
Show Gist options
  • Save geomagilles/c7ec68187d0bbe075caabb019d86da29 to your computer and use it in GitHub Desktop.
Save geomagilles/c7ec68187d0bbe075caabb019d86da29 to your computer and use it in GitHub Desktop.
<?php
use Zenaton\Interfaces\WorkflowInterface;
use Zenaton\Tasks\Wait;
use Zenaton\Traits\Zenatonable;
class RequestManagementWorkflow implements WorkflowInterface
{
use Zenatonable;
protected $request;
public function __construct($request)
{
$this->request = $request;
}
public function getId()
{
return $this->request->id;
}
public function handle()
{
// wait for moderation
$event = (new Wait(RequestModerationEvent::class))->execute();
// if rejected, tell user
if ($event->rejected) {
(new SendRejectionNotification($this->request, $event->reason))->execute();
return;
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment