diff --git a/src/codegen.inc.php b/src/codegen.inc.php index f2d1998..7f0eb9d 100644 --- a/src/codegen.inc.php +++ b/src/codegen.inc.php @@ -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/");