Manuel:ContextSource.php
Appearance
Outdated translations are marked like this.
Fichier MediaWiki : ContextSource.php | |
---|---|
Emplacement : | includes/context/ |
Code source : | master • 1.42.3 • 1.41.4 • 1.39.10 |
Classes : | ContextSource |
Le fichier ContextSource.php tient des conteneurs d'objets dépendants aux requêtes.
It implements IContextSource.
Public methods
- getContext()
- setContext()
- etc.
Extended by
Notes
From a ContextSource class you can use setContext() to set the context your class is in. For example a constructor that requires a context can be written like so:
class SomeClass extends ContextSource {
public function __constructor( IContextSource $context ) {
$this->setContext( $context );
}
}
Because we cannot use traits[1] yet if you need to make your class extend from another class you will have to implements IContextSource
and implement the helper boilerplate directly in the class.
Again if you can't extend ContextSource you'll have to write the helper boilerplate into your class directly. As we unfortunately cannot use traits[1] to allow something like this:
class SomeClass extends SomeOtherClass implements IContextSource {
use TContextSource;
public function __constructor( IContextSource $context ) {
$this->setContext( $context );
}
}