for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Facile\MongoDbBundle\Services\Loggers;
use Facile\MongoDbBundle\Services\Loggers\Model\LogEvent;
use Symfony\Component\Asset\Exception\LogicException;
/**
* Class MongoLogger
*/
class MongoLogger implements DataCollectorLoggerInterface
{
/** @var \SplQueue|LogEvent[] */
private $logs;
* MongoLogger constructor.
public function __construct()
$this->logs = new \SplQueue();
}
* @param LogEvent $event
public function logQuery(LogEvent $event)
$this->logs->enqueue($event);
* @return bool
public function hasLoggedEvents(): bool
return !$this->logs->isEmpty();
* @return LogEvent
public function getLoggedEvent(): LogEvent
if (!$this->hasLoggedEvents()) {
throw new LogicException('No more events logged!');
return $this->logs->dequeue();