public function add($name, callable $command, $default = false) {
        // Make sure to unify command name
        $commandName = strtolower($name);

        if (isset($this->_command[$commandName])) {
            throw new \Console\Exception\Runtime('Duplicated command.');
        }

        if (!is_null($this->_default) && $default) {
            throw new \Console\Exception\Runtime('Default command was already declared.');
        }

        if ($default) {
            $this->_default = $command;
        }

        // Add command
        $this->_commands[$commandName] = $command;
    }
public function add($name, callable $command, $default = false) {
        // Make sure to unify command name
        $commandName = strtolower($name);

        if (isset($this->_command[$commandName])) {
            throw new \Console\Exception\Runtime('Duplicated command.');
        }

        if (!is_null($this->_default) && $default) {
            throw new \Console\Exception\Runtime('Default command was already declared.');
        }

        if ($default) {
            $this->_default = $command;
        }

        // Add command
        $this->_commands[$commandName] = $command;
    }
public function add ( $ name , callable $ command , $ default = false ) { // Make sure to unify command name $ commandName = strtolower ( $ name ) ; if ( isset ( $ this -> _command [ $ commandName ] ) ) { throw new \ Console \ Exception \ Runtime ( 'Duplicated command.' ) ; } if ( ! is_null ( $ this -> _default ) && $ default ) { throw new \ Console \ Exception \ Runtime ( 'Default command was already declared.' ) ; } if ( $ default ) { $ this -> _default = $ command ; } // Add command $ this -> _commands [ $ commandName ] = $ command ; }
Add console command

@param   string      $name       Command Name
@param   callable    $command    Callable command
@param   boolean     $default    Use as default command (false)
@return  void
@throws  \Console\Exception\Runtime  Duplicated command registered
Add console command