You are here

public static function Application::getAbbreviations in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/console/Application.php \Symfony\Component\Console\Application::getAbbreviations()

Returns an array of possible abbreviations given a set of names.

Parameters

array $names An array of names:

Return value

array An array of abbreviations

File

vendor/symfony/console/Application.php, line 566

Class

Application
An Application is the container for a collection of commands.

Namespace

Symfony\Component\Console

Code

public static function getAbbreviations($names) {
  $abbrevs = array();
  foreach ($names as $name) {
    for ($len = strlen($name); $len > 0; --$len) {
      $abbrev = substr($name, 0, $len);
      $abbrevs[$abbrev][] = $name;
    }
  }
  return $abbrevs;
}