private const FOREACH_REGEX = '/{foreach\s+\w+=[a-zA-Z0-9\$](.*)}/m';
private const ATTR_REGEX = '/(\s*(?<key>\w+)=(?<value>[a-zA-Z0-9\$]+)\s*)/';
public function completer(array
$context, string
$smartyCode): array
{ foreach ($this->
getMatches($smartyCode) as $match) { if (!
isset($match['from'
],
$match['item'
])) { continue;
} $value =
$this->
getValueFromPath($context,
$match['from'
]);
if ($value === null
) { continue;
} $count = \
count($value);
if ($count) { $key =
array_keys($value)[0
];
$context[$match['item'
]] =
$value[$key];
if (isset($match['key'
])) {