3 * Deal with importing all those nasty globals and things
5 * Copyright © 2003 Brion Vibber <brion@pobox.com>
6 * https://www.mediawiki.org/
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 * http://www.gnu.org/copyleft/gpl.html
27 * Similar to FauxRequest, but only fakes URL parameters and method
28 * (POST or GET) and use the base request for the remaining stuff
29 * (cookies, session and headers).
34 class DerivativeRequest
extends FauxRequest
{
38 * @param WebRequest $base
39 * @param array $data Array of *non*-urlencoded key => value pairs, the
40 * fake GET/POST values
41 * @param bool $wasPosted Whether to treat the data as POST
43 public function __construct( WebRequest
$base, $data, $wasPosted = false ) {
45 parent
::__construct( $data, $wasPosted );
48 public function getCookie( $key, $prefix = null, $default = null ) {
49 return $this->base
->getCookie( $key, $prefix, $default );
52 public function checkSessionCookie() {
53 return $this->base
->checkSessionCookie();
56 public function getHeader( $name, $flags = 0 ) {
57 return $this->base
->getHeader( $name, $flags );
60 public function getAllHeaders() {
61 return $this->base
->getAllHeaders();
64 public function getSession() {
65 return $this->base
->getSession();
68 public function getSessionData( $key ) {
69 return $this->base
->getSessionData( $key );
72 public function setSessionData( $key, $data ) {
73 $this->base
->setSessionData( $key, $data );
76 public function getAcceptLang() {
77 return $this->base
->getAcceptLang();
80 public function getIP() {
81 return $this->base
->getIP();
84 public function getProtocol() {
85 return $this->base
->getProtocol();
88 public function getElapsedTime() {
89 return $this->base
->getElapsedTime();