getBlockParams() public static method

Get block params and fix the variable list
public static getBlockParams ( arrayinteger | array> &$vars ) : array | null
$vars arrayinteger | array>
return array | null
Esempio n. 1
0
 /**
  * compile {{with}} token
  *
  * @param array<string,array|string|integer> $context current compile context
  * @param array<boolean|integer|string|array> $vars parsed arguments list
  *
  * @return string|null Return compiled code segment for the token
  */
 protected static function with(&$context, $vars)
 {
     $v = isset($vars[1]) ? static::getVariableNameOrSubExpression($context, $vars[1]) : array(null, array());
     $bp = Parser::getBlockParams($vars);
     $bs = $bp ? 'array(' . Expression::listString($bp) . ')' : 'null';
     $be = $bp ? " as |{$bp['0']}|" : '';
     return $context['ops']['seperator'] . static::getFuncName($context, 'wi', 'with ' . $v[1] . $be) . "\$cx, {$v[0]}, {$bs}, \$in, function(\$cx, \$in) {{$context['ops']['f_start']}";
 }