for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the Ivory CKEditor package.
*
* (c) Eric GELOEN <[email protected]>
* For the full copyright and license information, please read the LICENSE
* file that was distributed with this source code.
*/
namespace FOS\CKEditorBundle\Model;
use FOS\CKEditorBundle\Exception\TemplateManagerException;
/**
* @author GeLo <[email protected]>
class TemplateManager implements TemplateManagerInterface
{
* @var array
private $templates = [];
* @param array $templates
public function __construct(array $templates = [])
$this->setTemplates($templates);
}
* {@inheritdoc}
public function hasTemplates()
return !empty($this->templates);
public function getTemplates()
return $this->templates;
public function setTemplates(array $templates)
foreach ($templates as $name => $template) {
$this->setTemplate($name, $template);
public function hasTemplate($name)
return isset($this->templates[$name]);
public function getTemplate($name)
if (!$this->hasTemplate($name)) {
throw TemplateManagerException::templateDoesNotExist($name);
return $this->templates[$name];
public function setTemplate($name, array $template)
$this->templates[$name] = $template;