MediaWiki  1.34.4
DerivativeResourceLoaderContext.php
Go to the documentation of this file.
1 <?php
32  const INHERIT_VALUE = -1;
33 
37  private $context;
38 
50 
52  $this->context = $context;
53  }
54 
55  public function getModules() {
56  if ( $this->modules === self::INHERIT_VALUE ) {
57  return $this->context->getModules();
58  }
59 
60  return $this->modules;
61  }
62 
66  public function setModules( array $modules ) {
67  $this->modules = $modules;
68  }
69 
70  public function getLanguage() {
71  if ( $this->language === self::INHERIT_VALUE ) {
72  return $this->context->getLanguage();
73  }
74  return $this->language;
75  }
76 
80  public function setLanguage( $language ) {
81  $this->language = $language;
82  // Invalidate direction since it is based on language
83  $this->direction = null;
84  $this->hash = null;
85  }
86 
87  public function getDirection() {
88  if ( $this->direction === self::INHERIT_VALUE ) {
89  return $this->context->getDirection();
90  }
91  if ( $this->direction === null ) {
92  $this->direction = Language::factory( $this->getLanguage() )->getDir();
93  }
94  return $this->direction;
95  }
96 
100  public function setDirection( $direction ) {
101  $this->direction = $direction;
102  $this->hash = null;
103  }
104 
105  public function getSkin() {
106  if ( $this->skin === self::INHERIT_VALUE ) {
107  return $this->context->getSkin();
108  }
109  return $this->skin;
110  }
111 
115  public function setSkin( $skin ) {
116  $this->skin = $skin;
117  $this->hash = null;
118  }
119 
120  public function getUser() {
121  if ( $this->user === self::INHERIT_VALUE ) {
122  return $this->context->getUser();
123  }
124  return $this->user;
125  }
126 
130  public function setUser( $user ) {
131  $this->user = $user;
132  $this->hash = null;
133  $this->userObj = null;
134  }
135 
136  public function getDebug() {
137  if ( $this->debug === self::INHERIT_VALUE ) {
138  return $this->context->getDebug();
139  }
140  return $this->debug;
141  }
142 
146  public function setDebug( $debug ) {
147  $this->debug = $debug;
148  $this->hash = null;
149  }
150 
151  public function getOnly() {
152  if ( $this->only === self::INHERIT_VALUE ) {
153  return $this->context->getOnly();
154  }
155  return $this->only;
156  }
157 
161  public function setOnly( $only ) {
162  $this->only = $only;
163  $this->hash = null;
164  }
165 
166  public function getVersion() {
167  if ( $this->version === self::INHERIT_VALUE ) {
168  return $this->context->getVersion();
169  }
170  return $this->version;
171  }
172 
176  public function setVersion( $version ) {
177  $this->version = $version;
178  $this->hash = null;
179  }
180 
181  public function getRaw() {
182  if ( $this->raw === self::INHERIT_VALUE ) {
183  return $this->context->getRaw();
184  }
185  return $this->raw;
186  }
187 
191  public function setRaw( $raw ) {
192  $this->raw = $raw;
193  }
194 
195  public function getRequest() {
196  return $this->context->getRequest();
197  }
198 
199  public function getResourceLoader() {
200  return $this->context->getResourceLoader();
201  }
202 
203  public function getContentOverrideCallback() {
204  if ( $this->contentOverrideCallback === self::INHERIT_VALUE ) {
205  return $this->context->getContentOverrideCallback();
206  }
208  }
209 
216  public function setContentOverrideCallback( $callback ) {
217  $this->contentOverrideCallback = $callback;
218  }
219 
220 }
ResourceLoaderContext
Context object that contains information about the state of a specific ResourceLoader web request.
Definition: ResourceLoaderContext.php:33
DerivativeResourceLoaderContext\$skin
$skin
Definition: DerivativeResourceLoaderContext.php:43
DerivativeResourceLoaderContext\getContentOverrideCallback
getContentOverrideCallback()
Return the replaced-content mapping callback.
Definition: DerivativeResourceLoaderContext.php:203
DerivativeResourceLoaderContext\setVersion
setVersion( $version)
Definition: DerivativeResourceLoaderContext.php:176
DerivativeResourceLoaderContext\getResourceLoader
getResourceLoader()
Definition: DerivativeResourceLoaderContext.php:199
DerivativeResourceLoaderContext\$raw
$raw
Definition: DerivativeResourceLoaderContext.php:48
DerivativeResourceLoaderContext\getRequest
getRequest()
Definition: DerivativeResourceLoaderContext.php:195
DerivativeResourceLoaderContext\$modules
int array $modules
Definition: DerivativeResourceLoaderContext.php:40
DerivativeResourceLoaderContext\$debug
$debug
Definition: DerivativeResourceLoaderContext.php:45
DerivativeResourceLoaderContext\setLanguage
setLanguage( $language)
Definition: DerivativeResourceLoaderContext.php:80
DerivativeResourceLoaderContext\$contentOverrideCallback
$contentOverrideCallback
Definition: DerivativeResourceLoaderContext.php:49
DerivativeResourceLoaderContext\setRaw
setRaw( $raw)
Definition: DerivativeResourceLoaderContext.php:191
DerivativeResourceLoaderContext\getModules
getModules()
Definition: DerivativeResourceLoaderContext.php:55
DerivativeResourceLoaderContext\getSkin
getSkin()
Definition: DerivativeResourceLoaderContext.php:105
DerivativeResourceLoaderContext\setContentOverrideCallback
setContentOverrideCallback( $callback)
Definition: DerivativeResourceLoaderContext.php:216
DerivativeResourceLoaderContext\setSkin
setSkin( $skin)
Definition: DerivativeResourceLoaderContext.php:115
DerivativeResourceLoaderContext\setModules
setModules(array $modules)
Definition: DerivativeResourceLoaderContext.php:66
DerivativeResourceLoaderContext\setDebug
setDebug( $debug)
Definition: DerivativeResourceLoaderContext.php:146
DerivativeResourceLoaderContext\$context
ResourceLoaderContext $context
Definition: DerivativeResourceLoaderContext.php:37
DerivativeResourceLoaderContext\getOnly
getOnly()
Definition: DerivativeResourceLoaderContext.php:151
DerivativeResourceLoaderContext\getRaw
getRaw()
Definition: DerivativeResourceLoaderContext.php:181
DerivativeResourceLoaderContext\$version
$version
Definition: DerivativeResourceLoaderContext.php:47
DerivativeResourceLoaderContext\$user
$user
Definition: DerivativeResourceLoaderContext.php:44
DerivativeResourceLoaderContext\setDirection
setDirection( $direction)
Definition: DerivativeResourceLoaderContext.php:100
DerivativeResourceLoaderContext
A mutable version of ResourceLoaderContext.
Definition: DerivativeResourceLoaderContext.php:31
DerivativeResourceLoaderContext\getDirection
getDirection()
Definition: DerivativeResourceLoaderContext.php:87
DerivativeResourceLoaderContext\$language
$language
Definition: DerivativeResourceLoaderContext.php:41
DerivativeResourceLoaderContext\INHERIT_VALUE
const INHERIT_VALUE
Definition: DerivativeResourceLoaderContext.php:32
DerivativeResourceLoaderContext\getLanguage
getLanguage()
Definition: DerivativeResourceLoaderContext.php:70
Language\factory
static factory( $code)
Get a cached or new language object for a given language code.
Definition: Language.php:217
DerivativeResourceLoaderContext\getVersion
getVersion()
Definition: DerivativeResourceLoaderContext.php:166
DerivativeResourceLoaderContext\setUser
setUser( $user)
Definition: DerivativeResourceLoaderContext.php:130
DerivativeResourceLoaderContext\setOnly
setOnly( $only)
Definition: DerivativeResourceLoaderContext.php:161
DerivativeResourceLoaderContext\getUser
getUser()
Definition: DerivativeResourceLoaderContext.php:120
DerivativeResourceLoaderContext\__construct
__construct(ResourceLoaderContext $context)
Definition: DerivativeResourceLoaderContext.php:51
DerivativeResourceLoaderContext\$direction
$direction
Definition: DerivativeResourceLoaderContext.php:42
DerivativeResourceLoaderContext\$only
$only
Definition: DerivativeResourceLoaderContext.php:46
DerivativeResourceLoaderContext\getDebug
getDebug()
Definition: DerivativeResourceLoaderContext.php:136