$hbs->addHelper('count', function (HbsTemplate $template, HbsContext $context, $args, $source) { return count($context->get($args)); }); $hbs->addHelper('join', function (HbsTemplate $template, HbsContext $context, $args, $source) { $matches = []; if (preg_match("#'([^']+)' (.+)#", $args, $matches)) { list(, $separator, $input) = $matches; $out = []; foreach ((array) $context->get($input) as $value) { $context->push($value); $out[] = $template->render($context); $context->pop(); } return implode($separator, $out); } return ''; }); return $hbs; }), 'Bigwhoop\\Trumpet\\Commands\\CommandExecutionContext' => DI\object(), 'Bigwhoop\\Trumpet\\Commands\\CommandHandler' => DI\factory(function (DIC $c) { $handler = new CommandHandler(); $handler->registerCommand($c->get('Bigwhoop\\Trumpet\\Commands\\CodeCommand')); $handler->registerCommand($c->get('Bigwhoop\\Trumpet\\Commands\\ExecCommand')); $handler->registerCommand($c->get('Bigwhoop\\Trumpet\\Commands\\IncludeCommand')); $handler->registerCommand($c->get('Bigwhoop\\Trumpet\\Commands\\ImageCommand')); $handler->registerCommand($c->get('Bigwhoop\\Trumpet\\Commands\\WikiCommand')); return $handler; }), 'PhpParser\\PrettyPrinterAbstract' => DI\object('\\PhpParser\\PrettyPrinter\\Standard'), 'PhpParser\\Lexer' => DI\object('PhpParser\\Lexer\\Emulative'), 'PhpParser\\ParserAbstract' => DI\object('PhpParser\\Parser')->constructor(DI\link('PhpParser\\Lexer')), 'PhpParser\\NodeTraverserInterface' => DI\object('PhpParser\\NodeTraverser')->method('addVisitor', DI\link('PhpParser\\NodeVisitor\\NameResolver'))]; $builder = new DI\ContainerBuilder(); $builder->addDefinitions(new DI\Definition\Source\ArrayDefinitionSource($definitions)); //$builder->useAnnotations(false); return $builder->build();