         response = user + ": " + response
 
       if version == 'php' and /function/.test url
-          robot.http(url).get() (err, res, body) ->
-            $ = cheerio.load body
-            methodSigContent = htmlStrip.html_strip $('.methodsynopsis').html(), compact_whitespace : true
-            msg.send response + " | #{methodSigContent}"
+        robot.http(url).get() (err, res, body) ->
+          $ = cheerio.load body
+          methodSigContent = htmlStrip.html_strip $('.methodsynopsis').html(), compact_whitespace : true
+          msg.send response + " | #{methodSigContent}"
       else
         if !url
           msg.send "No results for \"#{query}\""

    else if version == 'api'
      "site:laravel.com/api/4.1 #{query}"
    else if version == 'php'
        "site:www.php.net/manual/en #{query}"
    else if version?
      "site:laravel.com/docs/#{version} #{query}"
    else
      "site:laravel.com/docs #{query}"

  fetchResult = (query, callback) ->
    robot.http(API_URL).query(v: '1.0', q: query).get() (err, res, body) ->
      results = JSON.parse(body).responseData.results
      url = results[0] and results[0].url
      callback(url) if callback

  robot.hear /(([^:,\s!]+)[:,\s]+)?!docs\s([0-9.]+|api|dev|php)?\s?(.*)/i, (msg) ->
    user = msg.match[2]
    version = msg.match[3]

#   None

cheerio   = require 'cheerio'
htmlStrip = require 'htmlstrip-native'

SEARCH_URL = 'https://www.google.com/search'
# this gets the correct page structure, needs to be slimmed down
USER_AGENT = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/34.0.1847.116 Chrome/34.0.1847.116 Safari/537.36'

module.exports = (robot) ->
  getQueryUrl = (version, query) ->
