X-Git-Url: https://scripts.mit.edu/gitweb/autoinstallsdev/mediawiki.git/blobdiff_plain/19e297c21b10b1b8a3acad5e73fc71dcb35db44a..6932310fd58ebef145fa01eb76edf7150284d8ea:/includes/resourceloader/DerivativeResourceLoaderContext.php diff --git a/includes/resourceloader/DerivativeResourceLoaderContext.php b/includes/resourceloader/DerivativeResourceLoaderContext.php new file mode 100644 index 00000000..418d17f3 --- /dev/null +++ b/includes/resourceloader/DerivativeResourceLoaderContext.php @@ -0,0 +1,199 @@ +context = $context; + } + + public function getModules() { + if ( $this->modules === self::INHERIT_VALUE ) { + return $this->context->getModules(); + } + return $this->modules; + } + + /** + * @param string[] $modules + */ + public function setModules( array $modules ) { + $this->modules = $modules; + } + + public function getLanguage() { + if ( $this->language === self::INHERIT_VALUE ) { + return $this->context->getLanguage(); + } + return $this->language; + } + + /** + * @param string $language + */ + public function setLanguage( $language ) { + $this->language = $language; + // Invalidate direction since it is based on language + $this->direction = null; + $this->hash = null; + } + + public function getDirection() { + if ( $this->direction === self::INHERIT_VALUE ) { + return $this->context->getDirection(); + } + if ( $this->direction === null ) { + $this->direction = Language::factory( $this->getLanguage() )->getDir(); + } + return $this->direction; + } + + /** + * @param string $direction + */ + public function setDirection( $direction ) { + $this->direction = $direction; + $this->hash = null; + } + + public function getSkin() { + if ( $this->skin === self::INHERIT_VALUE ) { + return $this->context->getSkin(); + } + return $this->skin; + } + + /** + * @param string $skin + */ + public function setSkin( $skin ) { + $this->skin = $skin; + $this->hash = null; + } + + public function getUser() { + if ( $this->user === self::INHERIT_VALUE ) { + return $this->context->getUser(); + } + return $this->user; + } + + /** + * @param string|null $user + */ + public function setUser( $user ) { + $this->user = $user; + $this->hash = null; + $this->userObj = null; + } + + public function getDebug() { + if ( $this->debug === self::INHERIT_VALUE ) { + return $this->context->getDebug(); + } + return $this->debug; + } + + /** + * @param bool $debug + */ + public function setDebug( $debug ) { + $this->debug = $debug; + $this->hash = null; + } + + public function getOnly() { + if ( $this->only === self::INHERIT_VALUE ) { + return $this->context->getOnly(); + } + return $this->only; + } + + /** + * @param string|null $only + */ + public function setOnly( $only ) { + $this->only = $only; + $this->hash = null; + } + + public function getVersion() { + if ( $this->version === self::INHERIT_VALUE ) { + return $this->context->getVersion(); + } + return $this->version; + } + + /** + * @param string|null $version + */ + public function setVersion( $version ) { + $this->version = $version; + $this->hash = null; + } + + public function getRaw() { + if ( $this->raw === self::INHERIT_VALUE ) { + return $this->context->getRaw(); + } + return $this->raw; + } + + /** + * @param bool $raw + */ + public function setRaw( $raw ) { + $this->raw = $raw; + } + + public function getRequest() { + return $this->context->getRequest(); + } + + public function getResourceLoader() { + return $this->context->getResourceLoader(); + } + +}