public function getCommand($hostConnection = true)
    {
        if (is_null($this->username)) {
            throw new \InvalidArgumentException("You must specify a SSH username");
        }

        if (is_null($this->host)) {
            throw new \InvalidArgumentException("You must specify a SSH host to connect");
        }

        $command = new Command($this->executable);

        if ($this->port != 22) {
            $command->addArgument("p", $this->port);
        }

        if (!is_null($this->privateKey)) {
            $command->addArgument("i", $this->privateKey);
        }

        if ($hostConnection) {
            $command->addParameter($this->getHostConnection());
        }

        return $command;
    }