/**
* Group all the pieces relevant to the context of a request into one instance
*
+ * @since 1.18
+ *
* @author IAlex
* @author Daniel Friesen
* @file
*/
class RequestContext {
- private $mRequest; // / WebRequest object
- private $mTitle; // / Title object
- private $mOutput; // / OutputPage object
- private $mUser; // / User object
- private $mLang; // / Language object
- private $mSkin; // / Skin object
+
+ /**
+ * @var WebRequest
+ */
+ private $mRequest;
+
+ /**
+ * @var Title
+ */
+ private $mTitle;
+
+ /**
+ * @var OutputPage
+ */
+ private $mOutput;
+
+ /**
+ * @var User
+ */
+ private $mUser;
+
+ /**
+ * @var Language
+ */
+ private $mLang;
+
+ /**
+ * @var Skin
+ */
+ private $mSkin;
/**
* Set the WebRequest object
return $this->mTitle;
}
+ /**
+ * @param $o OutputPage
+ */
+ public function setOutput( OutputPage $o ) {
+ $this->mOutput = $o;
+ }
+
/**
* Get the OutputPage object
*
*/
public function getOutput() {
if ( !isset( $this->mOutput ) ) {
- $this->mOutput = new OutputPage;
- $this->mOutput->setContext( $this );
+ $this->mOutput = new OutputPage( $this );
}
return $this->mOutput;
}
* Make these C#-style accessors, so you can do $context->user->getName() which is
* internally mapped to $context->__get('user')->getName() which is mapped to
* $context->getUser()->getName()
+ *
+ * @param $name string
+ *
+ * @return string
*/
public function __get( $name ) {
+ wfDeprecated( 'RequestContext::__get() is deprecated; use $context->getFoo() instead' );
if ( in_array( $name, array( 'request', 'title', 'output', 'user', 'lang', 'skin' ) ) ) {
$fname = 'get' . ucfirst( $name );
return $this->$fname();
trigger_error( "Undefined property {$name}", E_NOTICE );
}
+ /**
+ * @param $name string
+ * @param $value
+ * @return string
+ */
public function __set( $name, $value ) {
+ wfDeprecated( 'RequestContext::__set() is deprecated; use $context->setFoo() instead' );
if ( in_array( $name, array( 'request', 'title', 'output', 'user', 'lang', 'skin' ) ) ) {
$fname = 'set' . ucfirst( $name );
return $this->$fname( $value );