MediaWiki  REL1_31
DerivativeRequest.php
Go to the documentation of this file.
1 <?php
35  private $base;
36 
43  public function __construct( WebRequest $base, $data, $wasPosted = false ) {
44  $this->base = $base;
45  parent::__construct( $data, $wasPosted );
46  }
47 
48  public function getCookie( $key, $prefix = null, $default = null ) {
49  return $this->base->getCookie( $key, $prefix, $default );
50  }
51 
52  public function getHeader( $name, $flags = 0 ) {
53  return $this->base->getHeader( $name, $flags );
54  }
55 
56  public function getAllHeaders() {
57  return $this->base->getAllHeaders();
58  }
59 
60  public function getSession() {
61  return $this->base->getSession();
62  }
63 
64  public function getSessionData( $key ) {
65  return $this->base->getSessionData( $key );
66  }
67 
68  public function setSessionData( $key, $data ) {
69  $this->base->setSessionData( $key, $data );
70  }
71 
72  public function getAcceptLang() {
73  return $this->base->getAcceptLang();
74  }
75 
76  public function getIP() {
77  return $this->base->getIP();
78  }
79 
80  public function getProtocol() {
81  return $this->base->getProtocol();
82  }
83 
84  public function getElapsedTime() {
85  return $this->base->getElapsedTime();
86  }
87 }
DerivativeRequest
Similar to FauxRequest, but only fakes URL parameters and method (POST or GET) and use the base reque...
Definition: DerivativeRequest.php:34
FauxRequest
WebRequest clone which takes values from a provided array.
Definition: FauxRequest.php:33
DerivativeRequest\getAllHeaders
getAllHeaders()
Get an array containing all request headers.
Definition: DerivativeRequest.php:56
DerivativeRequest\setSessionData
setSessionData( $key, $data)
Set session data.
Definition: DerivativeRequest.php:68
DerivativeRequest\getIP
getIP()
Work out the IP address based on various globals For trusted proxies, use the XFF client IP (first of...
Definition: DerivativeRequest.php:76
DerivativeRequest\getAcceptLang
getAcceptLang()
Parse the Accept-Language header sent by the client into an array.
Definition: DerivativeRequest.php:72
php
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:37
DerivativeRequest\getSessionData
getSessionData( $key)
Get data from the session.
Definition: DerivativeRequest.php:64
DerivativeRequest\getProtocol
getProtocol()
Get the current URL protocol (http or https)
Definition: DerivativeRequest.php:80
DerivativeRequest\getElapsedTime
getElapsedTime()
Get the number of seconds to have elapsed since request start, in fractional seconds,...
Definition: DerivativeRequest.php:84
DerivativeRequest\$base
$base
Definition: DerivativeRequest.php:35
WebRequest\$data
$data
Definition: WebRequest.php:39
DerivativeRequest\getHeader
getHeader( $name, $flags=0)
Get a request header, or false if it isn't set.
Definition: DerivativeRequest.php:52
WebRequest
The WebRequest class encapsulates getting at data passed in the URL or via a POSTed form stripping il...
Definition: WebRequest.php:38
FauxRequest\$wasPosted
$wasPosted
Definition: FauxRequest.php:34
DerivativeRequest\getSession
getSession()
Return the session for this request.
Definition: DerivativeRequest.php:60
$name
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:302
DerivativeRequest\__construct
__construct(WebRequest $base, $data, $wasPosted=false)
Definition: DerivativeRequest.php:43
DerivativeRequest\getCookie
getCookie( $key, $prefix=null, $default=null)
Get a cookie from the $_COOKIE jar.
Definition: DerivativeRequest.php:48