CommandNotFoundException.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. /**
  19. * @var mixed[]
  20. */
  21. private $alternatives;
  22. /**
  23. * @param string $message Exception message to throw
  24. * @param string[] $alternatives List of similar defined names
  25. * @param int $code Exception code
  26. * @param \Throwable|null $previous Previous exception used for the exception chaining
  27. */
  28. public function __construct($message, $alternatives = [], $code = 0, $previous = null)
  29. {
  30. parent::__construct($message, $code, $previous);
  31. $this->alternatives = $alternatives;
  32. }
  33. /**
  34. * @return string[]
  35. */
  36. public function getAlternatives()
  37. {
  38. return $this->alternatives;
  39. }
  40. }