summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/Maps/src/Presentation/OutputFacade.php
diff options
context:
space:
mode:
authorYaco <franco@reevo.org>2021-10-19 20:24:11 -0300
committerYaco <franco@reevo.org>2021-10-19 20:24:11 -0300
commite3880a1c86acaa3bbd05786ad2f5c586e6511a58 (patch)
treeec77bfc5b69f259a159c95188797bd0dade92357 /www/wiki/extensions/Maps/src/Presentation/OutputFacade.php
parent20ca0685509f8010580d3b45036a64ab48616af1 (diff)
updates Maps to 7.13.0
Diffstat (limited to 'www/wiki/extensions/Maps/src/Presentation/OutputFacade.php')
-rw-r--r--www/wiki/extensions/Maps/src/Presentation/OutputFacade.php62
1 files changed, 62 insertions, 0 deletions
diff --git a/www/wiki/extensions/Maps/src/Presentation/OutputFacade.php b/www/wiki/extensions/Maps/src/Presentation/OutputFacade.php
new file mode 100644
index 00000000..119f3b1d
--- /dev/null
+++ b/www/wiki/extensions/Maps/src/Presentation/OutputFacade.php
@@ -0,0 +1,62 @@
+<?php
+
+namespace Maps\Presentation;
+
+use OutputPage;
+use ParserOutput;
+
+class OutputFacade {
+
+ /**
+ * @var OutputPage
+ */
+ private $outputPage;
+
+ /**
+ * @var ParserOutput
+ */
+ private $parserOutput;
+
+ public static function newFromOutputPage( OutputPage $outputPage ) {
+ $instance = new self();
+ $instance->outputPage = $outputPage;
+ return $instance;
+ }
+
+ public static function newFromParserOutput( ParserOutput $parserOutput ) {
+ $instance = new self();
+ $instance->parserOutput = $parserOutput;
+ return $instance;
+ }
+
+ public function addHtml( string $html ) {
+ if ( $this->outputPage !== null ) {
+ $this->outputPage->addHTML( $html );
+ }
+
+ if ( $this->parserOutput !== null ) {
+ $this->parserOutput->setText( $this->parserOutput->getRawText() . $html );
+ }
+ }
+
+ public function addModules( string ...$modules ) {
+ if ( $this->outputPage !== null ) {
+ $this->outputPage->addModules( $modules );
+ }
+
+ if ( $this->parserOutput !== null ) {
+ $this->parserOutput->addModules( $modules );
+ }
+ }
+
+ public function addHeadItem( string $name, string $html ) {
+ if ( $this->outputPage !== null ) {
+ $this->outputPage->addHeadItem( $name, $html );
+ }
+
+ if ( $this->parserOutput !== null ) {
+ $this->parserOutput->addHeadItem( $html, $name );
+ }
+ }
+
+}