for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace hiapi\event;
/**
* Trait EventTrait
*
* @author Dmytro Naumenko <[email protected]>
*/
trait EventAwareTrait
{
* @var EventInterface[]
private $events = [];
* Registers that $event occurred
* @param EventInterface $event
public function recordThat(EventInterface $event): void
$this->events[] = $event;
}
* @return EventInterface[] of occurred events
public function releaseEvents(): array
$events = $this->events;
$this->events = [];
return $events;