aboutsummaryrefslogtreecommitdiffstats
path: root/includes/Rest/SimpleHandler.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/Rest/SimpleHandler.php')
-rw-r--r--includes/Rest/SimpleHandler.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/includes/Rest/SimpleHandler.php b/includes/Rest/SimpleHandler.php
new file mode 100644
index 000000000000..65bc0f59dd26
--- /dev/null
+++ b/includes/Rest/SimpleHandler.php
@@ -0,0 +1,19 @@
+<?php
+
+namespace MediaWiki\Rest;
+
+/**
+ * A handler base class which unpacks attributes from the path template and
+ * passes them as formal parameters to run().
+ *
+ * run() must be declared in the subclass. It cannot be declared as abstract
+ * here because it has a variable parameter list.
+ *
+ * @package MediaWiki\Rest
+ */
+class SimpleHandler extends Handler {
+ public function execute() {
+ $params = array_values( $this->getRequest()->getAttributes() );
+ return $this->run( ...$params );
+ }
+}