summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/Translate/webservices/TranslationQuery.php
diff options
context:
space:
mode:
Diffstat (limited to 'www/wiki/extensions/Translate/webservices/TranslationQuery.php')
-rw-r--r--www/wiki/extensions/Translate/webservices/TranslationQuery.php43
1 files changed, 39 insertions, 4 deletions
diff --git a/www/wiki/extensions/Translate/webservices/TranslationQuery.php b/www/wiki/extensions/Translate/webservices/TranslationQuery.php
index ce7135cd..3e0fbf31 100644
--- a/www/wiki/extensions/Translate/webservices/TranslationQuery.php
+++ b/www/wiki/extensions/Translate/webservices/TranslationQuery.php
@@ -4,7 +4,7 @@
*
* @file
* @author Niklas Laxström
- * @license GPL-2.0+
+ * @license GPL-2.0-or-later
*/
/**
@@ -16,12 +16,18 @@ class TranslationQuery {
protected $url;
protected $timeout = 0;
protected $method = 'GET';
- protected $params = array();
+ protected $params = [];
protected $body;
+ protected $headers = [];
+
+ /**
+ * @var mixed Arbitrary data that is returned with TranslationQueryResponse
+ */
+ protected $instructions;
// URL is mandatory, so using it here
public static function factory( $url ) {
- $obj = new TranslationQuery();
+ $obj = new self();
$obj->url = $url;
return $obj;
}
@@ -38,16 +44,32 @@ class TranslationQuery {
return $this;
}
- public function queryParamaters( array $params ) {
+ public function queryParameters( array $params ) {
$this->params = $params;
return $this;
}
+ public function queryHeaders( array $headers ) {
+ $this->headers = $headers;
+ return $this;
+ }
+
public function timeout( $timeout ) {
$this->timeout = $timeout;
return $this;
}
+ /**
+ * Attach arbitrary data that is necessary to process the results.
+ * @param mixed $data
+ * @return self
+ * @since 2017.04
+ */
+ public function attachProcessingInstructions( $data ) {
+ $this->instructions = $data;
+ return $this;
+ }
+
public function getTimeout() {
return $this->timeout;
}
@@ -67,4 +89,17 @@ class TranslationQuery {
public function getBody() {
return $this->body;
}
+
+ public function getHeaders() {
+ return $this->headers;
+ }
+
+ /**
+ * Get previously attached result processing instructions.
+ * @return mixed
+ * @since 2017.04
+ */
+ public function getProcessingInstructions() {
+ return $this->instructions;
+ }
}