public function Twig_Environment::computeAlternatives in Translation template extractor 6.3
Same name and namespace in other branches
- 7.3 vendor/Twig/Environment.php \Twig_Environment::computeAlternatives()
File
- vendor/
Twig/ Environment.php, line 1114
Class
- Twig_Environment
- Stores the Twig configuration.
Code
public function computeAlternatives($name, $items) {
$alternatives = array();
foreach ($items as $item) {
$lev = levenshtein($name, $item);
if ($lev <= strlen($name) / 3 || false !== strpos($item, $name)) {
$alternatives[$item] = $lev;
}
}
asort($alternatives);
return array_keys($alternatives);
}