ameliabooking
/
vendor
/
league
/
tactician
/
src
/
Exception
/
CanNotDetermineCommandNameException.php
CanNotDetermineCommandNameException.php
7 years ago
CanNotInvokeHandlerException.php
7 years ago
Exception.php
7 years ago
InvalidCommandException.php
7 years ago
InvalidMiddlewareException.php
7 years ago
MissingHandlerException.php
7 years ago
CanNotDetermineCommandNameException.php
40 lines
| 1 | <?php |
| 2 | |
| 3 | namespace League\Tactician\Exception; |
| 4 | |
| 5 | /** |
| 6 | * Thrown when a CommandNameExtractor cannot determine the command's name |
| 7 | */ |
| 8 | class CanNotDetermineCommandNameException extends \RuntimeException implements Exception |
| 9 | { |
| 10 | /** |
| 11 | * @var mixed |
| 12 | */ |
| 13 | private $command; |
| 14 | |
| 15 | /** |
| 16 | * @param mixed $command |
| 17 | * |
| 18 | * @return static |
| 19 | */ |
| 20 | public static function forCommand($command) |
| 21 | { |
| 22 | $type = is_object($command) ? get_class($command) : gettype($command); |
| 23 | |
| 24 | $exception = new static('Could not determine command name of ' . $type); |
| 25 | $exception->command = $command; |
| 26 | |
| 27 | return $exception; |
| 28 | } |
| 29 | |
| 30 | /** |
| 31 | * Returns the command that could not be invoked |
| 32 | * |
| 33 | * @return mixed |
| 34 | */ |
| 35 | public function getCommand() |
| 36 | { |
| 37 | return $this->command; |
| 38 | } |
| 39 | } |
| 40 |