for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Sludio\HelperBundle\Script\Twig;
trait TwigTrait
{
private $shortFunctions;
public function makeArray(array $input, $type = 'filter')
$output = [];
$class = '\\Twig_Simple'.ucfirst($type);
$this->makeInput($input, $input);
foreach ($input as $call => $function) {
if (\is_array($function)) {
$options = isset($function[2]) ? $function[2] : [];
unset($function[2]);
$output[] = new $class($call, $function, $options);
} else {
$output[] = new $class($call, [
$this,
$function,
]);
}
return $output;
private function makeInput(array $input, &$output)
if ($this->shortFunctions) {
$output[$call] = $function;
$output['sludio_'.$call] = $function;