Skip to content

Commit

Permalink
Fix Sensiolabs violations
Browse files Browse the repository at this point in the history
  • Loading branch information
byjg committed Feb 4, 2016
1 parent 6e2496d commit 9d9ee0a
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion SparQL/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace SparQL;

use ByJG\Util\CurlException;
use ByJG\Util\WebRequest;
use SparQL\Exception;

class Connection
{
Expand Down Expand Up @@ -66,6 +66,13 @@ public function alive($timeout = 3)
}
}

/**
*
* @param string $sparql
* @param int $timeout Timeout in mileseconds
* @return string
* @throws Exception
*/
public function dispatchQuery($sparql, $timeout = null)
{
$url = $this->endpoint . "?query=" . urlencode($sparql);
Expand All @@ -77,6 +84,10 @@ public function dispatchQuery($sparql, $timeout = null)
}

$webRequest = new WebRequest($url);

if (!empty($timeout)) {
$webRequest->setCurlOption(CURLOPT_TIMEOUT_MS, $timeout);
}

$output = $webRequest->get();

Expand Down

0 comments on commit 9d9ee0a

Please sign in to comment.