for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
/*
* This file is part of Symplify
* Copyright (c) 2016 Tomas Votruba (http://tomasvotruba.cz).
*/
namespace Symplify\PHP7_Sculpin\Renderable\Latte;
use Latte\ILoader;
/**
* Inspired by @see \Latte\Loaders\StringLoader.
final class DynamicStringLoader implements ILoader
{
* @var array [name => content]
private $templates = [];
public function addTemplate(string $name, string $content)
$this->templates[$name] = $content;
}
* {@inheritdoc}
public function getContent($name) : string
if (isset($this->templates[$name])) {
return $this->templates[$name];
throw new \RuntimeException(
sprintf('Missing template "%s%', $name)
);
public function isExpired($name, $time) : bool
// needed?
return false;
public function getReferredName($name, $referringName) : string
return $name;
public function getUniqueId($name)
return $this->getContent($name);