Since: 1.0
Author: Bernhard Schussek (bschussek@gmail.com)
 /**
  * Creates an exception for the code {@link NAME_NOT_FOUND}.
  *
  * Suggested alternatives are searched in the passed commands.
  *
  * @param string            $commandName The command name that was not found.
  * @param CommandCollection $commands    A list of available commands that
  *                                       is searched for similar names.
  * @param Exception         $cause       The exception that caused this
  *                                       exception.
  *
  * @return static The created exception.
  */
 public static function nameNotFound($commandName, CommandCollection $commands, Exception $cause = null)
 {
     $message = sprintf('The command "%s" is not defined.', $commandName);
     $suggestedNames = SimilarCommandName::find($commandName, $commands);
     if (count($suggestedNames) > 0) {
         if (1 === count($suggestedNames)) {
             $message .= "\n\nDid you mean this?\n    ";
         } else {
             $message .= "\n\nDid you mean one of these?\n    ";
         }
         $message .= implode("\n    ", $suggestedNames);
     }
     return new static($message, self::NAME_NOT_FOUND, $cause);
 }
 /**
  * @dataProvider getInputOutput
  */
 public function testFindSimilarNames($input, array $suggestions)
 {
     $commands = new CommandCollection(array(new Command(CommandConfig::create('package')->addAlias('package-alias')), new Command(CommandConfig::create('pack')->addAlias('pack-alias')), new Command(CommandConfig::create('pack'))));
     $this->assertSame($suggestions, SimilarCommandName::find($input, $commands));
 }