musonza/chat

View on GitHub
src/Eventing/EventGenerator.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php

namespace Musonza\Chat\Eventing;

trait EventGenerator
{
    protected $pendingEvents = [];

    public function raise($event)
    {
        $this->pendingEvents[] = $event;
    }

    public function releaseEvents()
    {
        $events = $this->pendingEvents;

        $this->pendingEvents = [];

        return $events;
    }
}