MediaWiki REL1_34
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}
A mutable version of ResourceLoaderContext.
__construct(ResourceLoaderContext $context)
getContentOverrideCallback()
Return the replaced-content mapping callback.
Context object that contains information about the state of a specific ResourceLoader web request.