for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Genkgo\Mail\Queue;
use Genkgo\Mail\Exception\EmptyQueueException;
use Genkgo\Mail\MessageInterface;
/**
* Class FlushableQueue
* @package Genkgo\Mail\Queue
*/
final class FlushableQueue implements QueueInterface
{
* @var QueueInterface
private $decoratedQueue;
public function __construct(QueueInterface $queue)
$this->decoratedQueue = $queue;
}
public function flush(): int
$count = 0;
try {
while ($this->decoratedQueue->fetch()) {
++$count;
} catch (EmptyQueueException $e) {
return $count;
* {@inheritdoc}
public function store(MessageInterface $message): void
$this->decoratedQueue->store($message);
public function fetch(): MessageInterface
return $this->decoratedQueue->fetch();