protected function prepareCommand()
    {
        $command = $this->getExecutable() . ' ';

        $keyFile = $this->getKeyFile();
        // @todo add file_exists($keyFile) === true
        // At the moment this is not working, because i don`t know a PHP function to resolve ~/.ssh/private_key_file
        // https://twitter.com/andygrunwald/status/315413070904184832
        // Further more, $keyFile can`t be escaped with escapeshellarg(),
        // because after this the command is not working anymore
        if ($keyFile) {
            $command .= '-i ' . $keyFile . ' ';
        }

        $port = $this->getPort();
        if ($port > 0) {
            $command .= '-p ' . $port . ' ';
        }

        $command .= implode(' ', $this->getCommandParts()) . ' ';
        $command .= implode(' ', $this->getArguments());

        $command = trim($command);
        if ($command) {
            $command .= ' 2>&1';
        }

        return $command;
    }