| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
> |
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
namespace MediaWiki\Request; |
| 27 |
|
| 28 |
use MediaWiki\Session\Session; |
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
class DerivativeRequest extends FauxRequest { |
| 41 |
private WebRequest $base; |
| 42 |
|
| 43 |
private $ip; |
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
public function __construct( WebRequest $base, $data, $wasPosted = false ) { |
| 54 |
$this->base = $base; |
| 55 |
parent::__construct( $data, $wasPosted ); |
| 56 |
} |
| 57 |
|
| 58 |
public function getCookie( $key, $prefix = null, $default = null ) { |
| 59 |
return $this->base->getCookie( $key, $prefix, $default ); |
| 60 |
} |
| 61 |
|
| 62 |
public function getHeader( $name, $flags = 0 ) { |
| 63 |
return $this->base->getHeader( $name, $flags ); |
| 64 |
} |
| 65 |
|
| 66 |
public function getAllHeaders() { |
| 67 |
return $this->base->getAllHeaders(); |
| 68 |
} |
| 69 |
|
| 70 |
public function getSession(): Session { |
| 71 |
return $this->base->getSession(); |
| 72 |
} |
| 73 |
|
| 74 |
public function getSessionData( $key ) { |
| 75 |
return $this->base->getSessionData( $key ); |
| 76 |
} |
| 77 |
|
| 78 |
public function setSessionData( $key, $data ) { |
| 79 |
$this->base->setSessionData( $key, $data ); |
| 80 |
} |
| 81 |
|
| 82 |
public function getAcceptLang() { |
| 83 |
return $this->base->getAcceptLang(); |
| 84 |
} |
| 85 |
|
| 86 |
public function getIP(): string { |
| 87 |
return $this->ip ?: $this->base->getIP(); |
| 88 |
} |
| 89 |
|
| 90 |
public function setIP( $ip ) { |
| 91 |
$this->ip = $ip; |
| 92 |
} |
| 93 |
|
| 94 |
public function getProtocol() { |
| 95 |
return $this->base->getProtocol(); |
| 96 |
} |
| 97 |
|
| 98 |
public function getUpload( $key ) { |
| 99 |
|
| 100 |
return $this->base->getUpload( $key ); |
| 101 |
} |
| 102 |
|
| 103 |
public function getElapsedTime() { |
| 104 |
return $this->base->getElapsedTime(); |
| 105 |
} |
| 106 |
} |
| 107 |
|
| 108 |
|
| 109 |
class_alias( DerivativeRequest::class, 'DerivativeRequest' ); |