3 * Derivative context for resource loader modules.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
25 * Allows changing specific properties of a context object,
26 * without changing the main one. Inspired by DerivativeContext.
30 class DerivativeResourceLoaderContext
extends ResourceLoaderContext
{
33 * @var ResourceLoaderContext
47 public function __construct( ResourceLoaderContext
$context ) {
48 $this->context
= $context;
51 public function getModules() {
52 if ( !is_null( $this->modules
) ) {
53 return $this->modules
;
55 return $this->context
->getModules();
60 * @param string[] $modules
62 public function setModules( array $modules ) {
63 $this->modules
= $modules;
66 public function getLanguage() {
67 if ( !is_null( $this->language
) ) {
68 return $this->language
;
70 return $this->context
->getLanguage();
75 * @param string $language
77 public function setLanguage( $language ) {
78 $this->language
= $language;
79 $this->direction
= null; // Invalidate direction since it might be based on language
83 public function getDirection() {
84 if ( !is_null( $this->direction
) ) {
85 return $this->direction
;
87 return $this->context
->getDirection();
92 * @param string $direction
94 public function setDirection( $direction ) {
95 $this->direction
= $direction;
99 public function getSkin() {
100 if ( !is_null( $this->skin
) ) {
103 return $this->context
->getSkin();
108 * @param string $skin
110 public function setSkin( $skin ) {
115 public function getUser() {
116 if ( !is_null( $this->user
) ) {
119 return $this->context
->getUser();
124 * @param string $user
126 public function setUser( $user ) {
129 $this->userObj
= null;
132 public function getDebug() {
133 if ( !is_null( $this->debug
) ) {
136 return $this->context
->getDebug();
143 public function setDebug( $debug ) {
144 $this->debug
= $debug;
148 public function getOnly() {
149 if ( !is_null( $this->only
) ) {
152 return $this->context
->getOnly();
157 * @param string $only
159 public function setOnly( $only ) {
164 public function getVersion() {
165 if ( !is_null( $this->version
) ) {
166 return $this->version
;
168 return $this->context
->getVersion();
173 * @param string $version
175 public function setVersion( $version ) {
176 $this->version
= $version;
180 public function getRaw() {
181 if ( !is_null( $this->raw
) ) {
184 return $this->context
->getRaw();
191 public function setRaw( $raw ) {
195 public function getRequest() {
196 return $this->context
->getRequest();
199 public function getResourceLoader() {
200 return $this->context
->getResourceLoader();