-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCommandNotFoundException.php
40 lines (33 loc) · 1.09 KB
/
CommandNotFoundException.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
namespace Vayes\Exception;
use Vayes\Exception\Interfaces\ExceptionInterface;
/**
* Represents an incorrect command name typed in the console.
*
* @author Jérôme Tamarelle <[email protected]>
*/
class CommandNotFoundException extends \InvalidArgumentException implements ExceptionInterface
{
private $alternatives;
/**
* @param string $message Exception message to throw
* @param array $alternatives List of similar defined names
* @param int $code Exception code
* @param \Throwable $previous Previous exception used for the exception chaining
*/
public function __construct(string $message, array $alternatives = [], int $code = 0, \Throwable $previous = null)
{
if (function_exists('trans')) {
$message = trans($message);
}
parent::__construct($message, $code, $previous);
$this->alternatives = $alternatives;
}
/**
* @return array A list of similar defined names
*/
public function getAlternatives()
{
return $this->alternatives;
}
}