Skip to content

Instantly share code, notes, and snippets.

@johnnncodes
Forked from rosstuck/EventGenerator.php
Last active August 29, 2015 14:13
Show Gist options
  • Save johnnncodes/307e517d34183efffd54 to your computer and use it in GitHub Desktop.
Save johnnncodes/307e517d34183efffd54 to your computer and use it in GitHub Desktop.
<?php
trait EventGenerator
{
protected $pendingEvents = array();
protected function raise($event)
{
$this->pendingEvents[] = $event;
}
public function releaseEvents()
{
$events = $this->pendingEvents;
$this->pendingEvents = array();
return $events;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment