summaryrefslogtreecommitdiff
path: root/bin/reevotech/vendor/addwiki/mediawiki-api-base/src/FluentRequest.php
diff options
context:
space:
mode:
authorYaco <franco@reevo.org>2021-10-19 20:42:50 -0300
committerYaco <franco@reevo.org>2021-10-19 20:42:50 -0300
commit1dc109c979d7788e8811b4eecfb8bfdf3b6ea6e2 (patch)
tree21d2a3bd6706af9eeb3e9d1def5a6ab8d8a67e93 /bin/reevotech/vendor/addwiki/mediawiki-api-base/src/FluentRequest.php
parent8c201ace3699b4928daf41eb7b4cdcb4565c6f3b (diff)
adds reevotech scripts
Diffstat (limited to 'bin/reevotech/vendor/addwiki/mediawiki-api-base/src/FluentRequest.php')
-rw-r--r--bin/reevotech/vendor/addwiki/mediawiki-api-base/src/FluentRequest.php118
1 files changed, 118 insertions, 0 deletions
diff --git a/bin/reevotech/vendor/addwiki/mediawiki-api-base/src/FluentRequest.php b/bin/reevotech/vendor/addwiki/mediawiki-api-base/src/FluentRequest.php
new file mode 100644
index 00000000..0d10553b
--- /dev/null
+++ b/bin/reevotech/vendor/addwiki/mediawiki-api-base/src/FluentRequest.php
@@ -0,0 +1,118 @@
+<?php
+
+namespace Mediawiki\Api;
+
+/**
+ * @since 1.0
+ *
+ * @author Addshore
+ */
+class FluentRequest implements Request {
+
+ /**
+ * @var array
+ */
+ private $params = [];
+
+ /**
+ * @var array
+ */
+ private $headers = [];
+
+ /**
+ * @since 1.0
+ *
+ * @return array
+ */
+ public function getParams() {
+ return $this->params;
+ }
+
+ /**
+ * @since 1.0
+ *
+ * @return array
+ */
+ public function getHeaders() {
+ return $this->headers;
+ }
+
+ /**
+ * @since 1.0
+ *
+ * @return static
+ */
+ public static function factory() {
+ return new static();
+ }
+
+ /**
+ * @since 1.0
+ *
+ * @param string $action The action name.
+ *
+ * @return $this
+ */
+ public function setAction( $action ) {
+ $this->setParam( 'action', $action );
+ return $this;
+ }
+
+ /**
+ * Totally overwrite any previously set params
+ *
+ * @since 1.0
+ *
+ * @param array $params New parameters.
+ *
+ * @return $this
+ */
+ public function setParams( array $params ) {
+ $this->params = $params;
+ return $this;
+ }
+
+ /**
+ * Totally overwrite any previously set params
+ *
+ * @since 1.0
+ *
+ * @param array $params Additional parameters.
+ *
+ * @return $this
+ */
+ public function addParams( array $params ) {
+ $this->params = array_merge( $this->params, $params );
+ return $this;
+ }
+
+ /**
+ * Set a single parameter.
+ *
+ * @since 1.0
+ *
+ * @param string $param The parameter name.
+ * @param string $value The parameter value.
+ *
+ * @return $this
+ */
+ public function setParam( $param, $value ) {
+ $this->params[$param] = $value;
+ return $this;
+ }
+
+ /**
+ * Totally overwrite any previously set HTTP headers.
+ *
+ * @since 1.0
+ *
+ * @param array $headers New headers.
+ *
+ * @return $this
+ */
+ public function setHeaders( $headers ) {
+ $this->headers = $headers;
+ return $this;
+ }
+
+}