From 9d9ee0ae2cf85db64fa62bf85be084ef54170712 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joao=20Gilberto=20Magalh=C3=A3es?= Date: Thu, 4 Feb 2016 15:22:14 -0200 Subject: [PATCH] Fix Sensiolabs violations --- SparQL/Connection.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/SparQL/Connection.php b/SparQL/Connection.php index a5fa9af..2ecf31a 100644 --- a/SparQL/Connection.php +++ b/SparQL/Connection.php @@ -2,8 +2,8 @@ namespace SparQL; -use ByJG\Util\CurlException; use ByJG\Util\WebRequest; +use SparQL\Exception; class Connection { @@ -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); @@ -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();