Adding convenience codegen(..) function
This commit is contained in:
parent
27f32804cc
commit
0b9db7e6a0
|
@ -2,6 +2,18 @@
|
|||
namespace metagen_php;
|
||||
use Exception;
|
||||
|
||||
function codegen(?string $cache_dir, \mtgMetaInfo $meta, array $options = []) : string
|
||||
{
|
||||
$twig = get_twig();
|
||||
|
||||
if(!empty($cache_dir))
|
||||
$twig->setCache($cache_dir);
|
||||
|
||||
$options['meta'] = $meta;
|
||||
|
||||
return $twig->render('codegen_bundle.twig', $options);
|
||||
}
|
||||
|
||||
function get_twig(array $inc_path = [])
|
||||
{
|
||||
array_unshift($inc_path, __DIR__ . "/../tpl/");
|
||||
|
|
Loading…
Reference in New Issue