for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Mathielen\ReportWriteEngine\Engine;
use Mathielen\ReportWriteEngine\Engine\Renderer\RendererInterface;
class RendererRepository
{
/**
* @var array
*/
private $reportConfig;
private $renderer = [];
public function __construct(array $reportConfig = [])
$this->reportConfig = $reportConfig;
}
* @return $this
public function setConfig(array $reportConfig = [])
return $this;
public function add($orientation, RendererInterface $renderer)
$this->renderer[$orientation] = $renderer;
* @return RendererInterface
public function getRendererForNode($nodeId)
$orientation = isset($this->reportConfig[$nodeId]) ? $this->reportConfig[$nodeId] : RendererInterface::ORIENTATION_VERTICAL;
if (!isset($this->renderer[$orientation])) {
throw new \RuntimeException("Could not find writer for orientation $orientation");
return $this->renderer[$orientation];