Webmozart\Console\Api\Command\CannotAddCommandException::nameEmpty PHP Method

nameEmpty() public static method

Creates an exception for the code {@link NAME_EMPTY}.
public static nameEmpty ( Exception $cause = null ) : static
$cause Exception The exception that caused this exception.
return static The created exception.
    public static function nameEmpty(Exception $cause = null)
    {
        return new static('The command name must be set.', self::NAME_EMPTY, $cause);
    }

Usage Example

Esempio n. 1
0
 private function validateCommandName(CommandConfig $config)
 {
     $name = $config->getName();
     if (!$name) {
         throw CannotAddCommandException::nameEmpty();
     }
     if ($this->commands->contains($name)) {
         throw CannotAddCommandException::nameExists($name);
     }
 }
All Usage Examples Of Webmozart\Console\Api\Command\CannotAddCommandException::nameEmpty