| Total Complexity | 7 |
| Total Lines | 34 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 5 | trait TwigTrait |
||
| 6 | { |
||
| 7 | private $shortFunctions; |
||
| 8 | |||
| 9 | public function makeArray(array $input, $type = 'filter') |
||
| 10 | { |
||
| 11 | $output = []; |
||
| 12 | $class = '\\Twig_Simple'.ucfirst($type); |
||
| 13 | $this->makeInput($input, $input); |
||
| 14 | |||
| 15 | foreach ($input as $call => $function) { |
||
| 16 | if (\is_array($function)) { |
||
| 17 | $options = isset($function[2]) ? $function[2] : []; |
||
| 18 | unset($function[2]); |
||
| 19 | $output[] = new $class($call, $function, $options); |
||
| 20 | } else { |
||
| 21 | $output[] = new $class($call, [ |
||
| 22 | $this, |
||
| 23 | $function, |
||
| 24 | ]); |
||
| 25 | } |
||
| 26 | } |
||
| 27 | |||
| 28 | return $output; |
||
| 29 | } |
||
| 30 | |||
| 31 | private function makeInput(array $input, &$output) |
||
| 39 | } |
||
| 40 | } |
||
| 42 |