[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/includes/libs/virtualrest/ -> VirtualRESTService.php (summary)

Virtual HTTP service client This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

File Size: 107 lines (5 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 3 functions

  __construct()
  onRequests()
  onResponses()

Functions
Functions that are not part of a class:

__construct( array $params )   X-Ref

param: array $params Key/value map

onRequests( array $reqs, Closure $idGeneratorFunc )   X-Ref
Prepare virtual HTTP(S) requests (for this service) for execution

This method should mangle any of the $reqs entry fields as needed:
- url      : munge the URL to have an absolute URL with a protocol
and encode path components as needed by the backend [required]
- query    : include any authentication signatures/parameters [as needed]
- headers  : include any authentication tokens/headers [as needed]

The incoming URL parameter will be relative to the service mount point.

This method can also remove some of the requests as well as add new ones
(using $idGenerator to set each of the entries' array keys). For any existing
or added request, the 'response' array can be filled in, which will prevent the
client from executing it. If an original request is removed, at some point it
must be added back (with the same key) in onRequests() or onResponses();
it's reponse may be filled in as with other requests.

param: array $reqs Map of Virtual HTTP request arrays
param: Closure $idGeneratorFunc Method to generate unique keys for new requests
return: array Modified HTTP request array map

onResponses( array $reqs, Closure $idGeneratorFunc )   X-Ref
Mangle or replace virtual HTTP(S) requests which have been responded to

This method may mangle any of the $reqs entry 'response' fields as needed:
- code    : perform any code normalization [as needed]
- reason  : perform any reason normalization [as needed]
- headers : perform any header normalization [as needed]

This method can also remove some of the requests as well as add new ones
(using $idGenerator to set each of the entries' array keys). For any existing
or added request, the 'response' array can be filled in, which will prevent the
client from executing it. If an original request is removed, at some point it
must be added back (with the same key) in onRequests() or onResponses();
it's reponse may be filled in as with other requests. All requests added to $reqs
will be passed through onRequests() to handle any munging required as normal.

The incoming URL parameter will be relative to the service mount point.

param: array $reqs Map of Virtual HTTP request arrays with 'response' set
param: Closure $idGeneratorFunc Method to generate unique keys for new requests
return: array Modified HTTP request array map



Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1