MediaWiki  REL1_24
DerivativeResourceLoaderContext.php
Go to the documentation of this file.
00001 <?php
00030 class DerivativeResourceLoaderContext extends ResourceLoaderContext {
00031 
00035     private $context;
00036     protected $modules;
00037     protected $language;
00038     protected $direction;
00039     protected $skin;
00040     protected $user;
00041     protected $debug;
00042     protected $only;
00043     protected $version;
00044     protected $hash;
00045     protected $raw;
00046 
00047     public function __construct( ResourceLoaderContext $context ) {
00048         $this->context = $context;
00049     }
00050 
00051     public function getModules() {
00052         if ( !is_null( $this->modules ) ) {
00053             return $this->modules;
00054         } else {
00055             return $this->context->getModules();
00056         }
00057     }
00058 
00062     public function setModules( array $modules ) {
00063         $this->modules = $modules;
00064     }
00065 
00066     public function getLanguage() {
00067         if ( !is_null( $this->language ) ) {
00068             return $this->language;
00069         } else {
00070             return $this->context->getLanguage();
00071         }
00072     }
00073 
00077     public function setLanguage( $language ) {
00078         $this->language = $language;
00079         $this->direction = null; // Invalidate direction since it might be based on language
00080         $this->hash = null;
00081     }
00082 
00083     public function getDirection() {
00084         if ( !is_null( $this->direction ) ) {
00085             return $this->direction;
00086         } else {
00087             return $this->context->getDirection();
00088         }
00089     }
00090 
00094     public function setDirection( $direction ) {
00095         $this->direction = $direction;
00096         $this->hash = null;
00097     }
00098 
00099     public function getSkin() {
00100         if ( !is_null( $this->skin ) ) {
00101             return $this->skin;
00102         } else {
00103             return $this->context->getSkin();
00104         }
00105     }
00106 
00110     public function setSkin( $skin ) {
00111         $this->skin = $skin;
00112         $this->hash = null;
00113     }
00114 
00115     public function getUser() {
00116         if ( !is_null( $this->user ) ) {
00117             return $this->user;
00118         } else {
00119             return $this->context->getUser();
00120         }
00121     }
00122 
00126     public function setUser( $user ) {
00127         $this->user = $user;
00128         $this->hash = null;
00129     }
00130 
00131     public function getDebug() {
00132         if ( !is_null( $this->debug ) ) {
00133             return $this->debug;
00134         } else {
00135             return $this->context->getDebug();
00136         }
00137     }
00138 
00142     public function setDebug( $debug ) {
00143         $this->debug = $debug;
00144         $this->hash = null;
00145     }
00146 
00147     public function getOnly() {
00148         if ( !is_null( $this->only ) ) {
00149             return $this->only;
00150         } else {
00151             return $this->context->getOnly();
00152         }
00153     }
00154 
00158     public function setOnly( $only ) {
00159         $this->only = $only;
00160         $this->hash = null;
00161     }
00162 
00163     public function getVersion() {
00164         if ( !is_null( $this->version ) ) {
00165             return $this->version;
00166         } else {
00167             return $this->context->getVersion();
00168         }
00169     }
00170 
00174     public function setVersion( $version ) {
00175         $this->version = $version;
00176         $this->hash = null;
00177     }
00178 
00179     public function getRaw() {
00180         if ( !is_null( $this->raw ) ) {
00181             return $this->raw;
00182         } else {
00183             return $this->context->getRaw();
00184         }
00185     }
00186 
00190     public function setRaw( $raw ) {
00191         $this->raw = $raw;
00192     }
00193 
00194     public function getRequest() {
00195         return $this->context->getRequest();
00196     }
00197 
00198     public function getResourceLoader() {
00199         return $this->context->getResourceLoader();
00200     }
00201 
00202 }