From e56d1196d6104f436a049178b7167a4e91485087 Mon Sep 17 00:00:00 2001
From: Alvaro Graves <alvaro@graves.cl>
Date: Wed, 27 Jul 2011 14:14:13 -0700
Subject: [PATCH] PHP doesn't allow redefine methods with different number of
 arguments

---
 classes/Endpoint.php | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/classes/Endpoint.php b/classes/Endpoint.php
index 22eec3fc..5cd7fa75 100644
--- a/classes/Endpoint.php
+++ b/classes/Endpoint.php
@@ -9,29 +9,27 @@ class Endpoint{
   	$this->params = $params;
   }
   
-  public function query($q, $output){
-    $aux = $this->params['output'];
-    $this->params['output'] = $output;
-    $r = $this->query($q);
-    $this->params['output'] = $aux;
-    return $r;
-  }
-  
-  public function query($q){
+  public function query($q, $output = null){
   	global $conf;
+  	$aux = $this->params['output'];
+  	if($output != null){
+  	  $this->params['output'] = $output;
+    }
   	$context = stream_context_create(array(
   	  'http' => array('header'=>'Connection: close')));
   	$params = $this->params;
   	$params['query'] = $q;
   	$url = $this->sparqlUrl.'?'.http_build_query($params, '', '&');
   	$aux = file_get_contents($url, false,$context);
+  	
+  	$this->params['output'] = $aux;
+  	
   	if(preg_match("/select/i", $q)){
   	  return json_decode($aux, true);
   	}
   	if(preg_match("/describe/i", $q)){
   	  return $aux;
-  	}
-
+  	}  	
   }
   
   public function queryPost($q){
-- 
GitLab