public function renderAlternatives($wrongName, $exception)
	{
		/** @var $exception \InvalidArgumentException */
		$message      = $exception->getMessage();
		$autoComplete = '';
		$alternatives = array();

		// Autocomplete
		foreach ($this->children as $command)
		{
			/** @var $command Command */
			$commandName = $command->getName();

			/*
			 * Here we use "Levenshtein distance" to compare wrong name with every command names.
			 *
			 * If the difference number less than 1/3 of wrong name which user typed, means this is a similar name,
			 * we can notice user to choose these similar names.
			 *
			 * And if the string of wrong name can be found in a command name, we also notice user to choose it.
			 */
			if (levenshtein($wrongName, $commandName) <= (strlen($wrongName) / 3) || strpos($commandName, $wrongName) !== false)
			{
				$alternatives[] = "    " . $commandName;
			}
		}

		if (count($alternatives))
		{
			$autoComplete = "Did you mean one of these?\n";
			$autoComplete .= implode($alternatives);
		}

		$this->out('');
		$this->err("<error>{$message}</error>");
		$this->out('');
		$this->err($autoComplete);
	}
public function renderAlternatives($wrongName, $exception)
	{
		/** @var $exception \InvalidArgumentException */
		$message      = $exception->getMessage();
		$autoComplete = '';
		$alternatives = array();

		// Autocomplete
		foreach ($this->children as $command)
		{
			/** @var $command Command */
			$commandName = $command->getName();

			/*
			 * Here we use "Levenshtein distance" to compare wrong name with every command names.
			 *
			 * If the difference number less than 1/3 of wrong name which user typed, means this is a similar name,
			 * we can notice user to choose these similar names.
			 *
			 * And if the string of wrong name can be found in a command name, we also notice user to choose it.
			 */
			if (levenshtein($wrongName, $commandName) <= (strlen($wrongName) / 3) || strpos($commandName, $wrongName) !== false)
			{
				$alternatives[] = "    " . $commandName;
			}
		}

		if (count($alternatives))
		{
			$autoComplete = "Did you mean one of these?\n";
			$autoComplete .= implode($alternatives);
		}

		$this->out('');
		$this->err("<error>{$message}</error>");
		$this->out('');
		$this->err($autoComplete);
	}
public function renderAlternatives ( $ wrongName , $ exception ) { /** @var $exception \InvalidArgumentException */ $ message = $ exception -> getMessage ( ) ; $ autoComplete = '' ; $ alternatives = array ( ) ; // Autocomplete foreach ( $ this -> children as $ command ) { /** @var $command Command */ $ commandName = $ command -> getName ( ) ; /*
			 * Here we use "Levenshtein distance" to compare wrong name with every command names.
			 *
			 * If the difference number less than 1/3 of wrong name which user typed, means this is a similar name,
			 * we can notice user to choose these similar names.
			 *
			 * And if the string of wrong name can be found in a command name, we also notice user to choose it.
			 */ if ( levenshtein ( $ wrongName , $ commandName ) <= ( strlen ( $ wrongName ) / 3 ) || strpos ( $ commandName , $ wrongName ) !== false ) { $ alternatives [ ] = "    " . $ commandName ; } } if ( count ( $ alternatives ) ) { $ autoComplete = "Did you mean one of these?\n" ; $ autoComplete .= implode ( $ alternatives ) ; } $ this -> out ( '' ) ; $ this -> err ( "<error>{$message}</error>" ) ; $ this -> out ( '' ) ; $ this -> err ( $ autoComplete ) ; }
Render auto complete alternatives.

@param   string                    $wrongName  The wrong command name to auto completed.
@param   CommandNotFoundException  $exception  The exception of wrong argument.

@return  void

@since   1.0
Render auto complete alternatives .