summaryrefslogtreecommitdiffstats
path: root/lib/private/ocs
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-08-07 13:12:43 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2015-08-07 13:12:43 +0200
commit0595c05200a97f70df572e14ed54289ca96621cd (patch)
treee1e34471edcec657b93a5458c54b2e18db94f41e /lib/private/ocs
parent43888bb9bf46928acfe79084377b96133609ef6c (diff)
downloadnextcloud-server-0595c05200a97f70df572e14ed54289ca96621cd.tar.gz
nextcloud-server-0595c05200a97f70df572e14ed54289ca96621cd.zip
Adding header support to class OC_OCS_Result
Diffstat (limited to 'lib/private/ocs')
-rw-r--r--lib/private/ocs/result.php45
1 files changed, 44 insertions, 1 deletions
diff --git a/lib/private/ocs/result.php b/lib/private/ocs/result.php
index 1ee2982ac4a..c4b0fbf33f3 100644
--- a/lib/private/ocs/result.php
+++ b/lib/private/ocs/result.php
@@ -27,7 +27,23 @@
class OC_OCS_Result{
- protected $data, $message, $statusCode, $items, $perPage;
+ /** @var array */
+ protected $data;
+
+ /** @var null|string */
+ protected $message;
+
+ /** @var int */
+ protected $statusCode;
+
+ /** @var integer */
+ protected $items;
+
+ /** @var integer */
+ protected $perPage;
+
+ /** @var array */
+ private $headers = [];
/**
* create the OCS_Result object
@@ -106,5 +122,32 @@ class OC_OCS_Result{
return ($this->statusCode == 100);
}
+ /**
+ * Adds a new header to the response
+ * @param string $name The name of the HTTP header
+ * @param string $value The value, null will delete it
+ * @return $this
+ */
+ public function addHeader($name, $value) {
+ $name = trim($name); // always remove leading and trailing whitespace
+ // to be able to reliably check for security
+ // headers
+
+ if(is_null($value)) {
+ unset($this->headers[$name]);
+ } else {
+ $this->headers[$name] = $value;
+ }
+
+ return $this;
+ }
+
+ /**
+ * Returns the set headers
+ * @return array the headers
+ */
+ public function getHeaders() {
+ return $this->headers;
+ }
}