MediaWiki
REL1_24
|
00001 <?php 00036 abstract class VirtualRESTService { 00038 protected $params = array(); 00039 00043 public function __construct( array $params ) { 00044 $this->params = $params; 00045 } 00046 00069 public function onRequests( array $reqs, Closure $idGeneratorFunc ) { 00070 $result = array(); 00071 foreach ( $reqs as $key => $req ) { 00072 // The default encoding treats the URL as a REST style path that uses 00073 // forward slash as a hierarchical delimiter (and never otherwise). 00074 // Subclasses can override this, and should be documented in any case. 00075 $parts = array_map( 'rawurlencode', explode( '/', $req['url'] ) ); 00076 $req['url'] = $this->params['baseUrl'] . '/' . implode( '/', $parts ); 00077 $result[$key] = $req; 00078 } 00079 return $result; 00080 } 00081 00104 public function onResponses( array $reqs, Closure $idGeneratorFunc ) { 00105 return $reqs; 00106 } 00107 }