src/Dudulina/CodeGeneration/TemplateLoader.php
<?php
/**
* Copyright (c) 2018 Constantin Galbenu <xprt64@gmail.com>
*/
namespace Dudulina\CodeGeneration;
class TemplateLoader
{
public function loadTemplate(string $content, string $templateClassName, string $templateNamespace, string $outputShortClassName, string $outputNamespace)
{
return str_replace(
[$templateClassName, '--- This is just a template ---', "namespace $templateNamespace;"],
[$outputShortClassName, '--- generated by ' . __FILE__ . ' at ' . date('c') . ' ---', $outputNamespace ? "namespace $outputNamespace;" : ''],
$content);
}
}