diff options
author | 2015-08-14 20:11:52 +0200 | |
---|---|---|
committer | 2015-08-14 20:11:52 +0200 | |
commit | 406658484ac434d75d47d082a907937aa2366ad1 (patch) | |
tree | 5071d7e22c8e43837be6912edcf726522c1c80a6 /SemanticMediaWiki/docs/technical/context.md | |
parent | Ignore Widget's compiled templates (diff) | |
download | extensions-406658484ac434d75d47d082a907937aa2366ad1.tar.gz extensions-406658484ac434d75d47d082a907937aa2366ad1.tar.bz2 extensions-406658484ac434d75d47d082a907937aa2366ad1.zip |
Remove extensions that will be pulled in via composer
Diffstat (limited to 'SemanticMediaWiki/docs/technical/context.md')
-rw-r--r-- | SemanticMediaWiki/docs/technical/context.md | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/SemanticMediaWiki/docs/technical/context.md b/SemanticMediaWiki/docs/technical/context.md deleted file mode 100644 index faf4d4f0..00000000 --- a/SemanticMediaWiki/docs/technical/context.md +++ /dev/null @@ -1,72 +0,0 @@ -A context object (see [Encapsulate Context Pattern][ak]) collects commonly used service objects and encapsulate those objects within a single available instance. - -## Components -* ContextResource describes an interface to access Store, Settings, and a DependencyBuilder context -* ContextAware describes an interface to access a context object -* ContextInjector describes an interface to inject an context object -* ExtensionContext implements the ContextResource interface -* EmptyContext implements the ContextResource interface, returning null objects - -#### Example -```php -class Foo implements ContextAware { - - /** @var ContextResource */ - protected $context = null; - - /** - * @since 1.9 - * - * @param ContextResource $context - */ - public function __construct( ContextResource $context = null ) { - $this->context = $context; - } - - public function withContext() { - - if ( $this->context === null ) { - $this->context = new ExtensionContext(); - } - - return $this->context; - } - - public function getBaz() { - return $this->withContext()->getDependencyBuilder()->newObject( 'Baz' ); - } - -} -``` -```php -class Bar implements ContextAware, ContextInjector { - - /** @var ContextResource */ - protected $context = null; - - public function invokeContext( ContextResource $context ) { - $this->context = $context; - } - - public function withContext() { - return $this->context; - } - - public function getBaz() { - return $this->withContext()->getDependencyBuilder()->newObject( 'Baz' ); - } - -} -``` -```php -$foo = new Foo( new ExtensionContext() ); -$baz = $foo->getBaz(); - -$bar = new Bar(); -$bar->invokeContext( new ExtensionContext() ); -$baz = $bar->getBaz(); -``` - -For information on "how to use" the DependencyBuilder, see [here](dic.md). - -[ak]: http://accu.org/index.php/journals/246 "The Encapsulate Context Pattern"
\ No newline at end of file |