<?php
namespace League\Event;
class BufferedEmitter extends Emitter
{
/**
* @var EventInterface[]
*/
protected $bufferedEvents = [];
/**
* @inheritdoc
*/
public function emit($event)
{
$this->bufferedEvents[] = $event;
return $event;
}
/**
* @inheritdoc
*/
public function emitBatch(array $events)
{
foreach ($events as $event) {
$this->bufferedEvents[] = $event;
}
return $events;
}
/**
* Emit the buffered events.
*
* @return array
*/
public function emitBufferedEvents()
{
$result = [];
while ($event = array_shift($this->bufferedEvents)) {
$result[] = parent::emit($event);
}
return $result;
}
}
In case of an error, the API will return an error response containing a specific error code 400, 403 Failed and a user-friendly message. Refer to our API documentation for a comprehensive list of error codes and their descriptions.