You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.2 KiB

3 years ago
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Console\Exception;
  11. /**
  12. * Represents an incorrect command name typed in the console.
  13. *
  14. * @author Jérôme Tamarelle <jerome@tamarelle.net>
  15. */
  16. class CommandNotFoundException extends \InvalidArgumentException implements ExceptionInterface
  17. {
  18. private $alternatives;
  19. /**
  20. * @param string $message Exception message to throw
  21. * @param string[] $alternatives List of similar defined names
  22. * @param int $code Exception code
  23. * @param \Throwable|null $previous Previous exception used for the exception chaining
  24. */
  25. public function __construct(string $message, array $alternatives = [], int $code = 0, \Throwable $previous = null)
  26. {
  27. parent::__construct($message, $code, $previous);
  28. $this->alternatives = $alternatives;
  29. }
  30. /**
  31. * @return string[] A list of similar defined names
  32. */
  33. public function getAlternatives()
  34. {
  35. return $this->alternatives;
  36. }
  37. }