public function Twig_Environment::computeAlternatives

File

drupal/core/vendor/twig/twig/lib/Twig/Environment.php, line 1084

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);
}