*/
abstract class VirtualRESTService {
/** @var array Key/value map */
- protected $params = array();
+ protected $params = [];
/**
* @param array $params Key/value map
$this->params = $params;
}
+ /**
+ * Return the name of this service, in a form suitable for error
+ * reporting or debugging.
+ *
+ * @return string The name of the service behind this VRS object.
+ */
+ public function getName() {
+ return isset( $this->params['name'] ) ? $this->params['name'] : static::class;
+ }
+
/**
* Prepare virtual HTTP(S) requests (for this service) for execution
*
* @return array Modified HTTP request array map
*/
public function onRequests( array $reqs, Closure $idGeneratorFunc ) {
- $result = array();
+ $result = [];
foreach ( $reqs as $key => $req ) {
// The default encoding treats the URL as a REST style path that uses
// forward slash as a hierarchical delimiter (and never otherwise).