2015-06-19 10:31:22 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Wikia\PortableInfobox\Helpers;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class PortableInfoboxDataBag
|
|
|
|
* @package Wikia\PortableInfobox\Helpers
|
|
|
|
*/
|
|
|
|
class PortableInfoboxDataBag {
|
|
|
|
private static $instance = null;
|
|
|
|
private $galleries = [ ];
|
|
|
|
|
|
|
|
private function __construct() {
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return null|PortableInfoboxDataBag
|
|
|
|
*/
|
|
|
|
public static function getInstance() {
|
|
|
|
if ( is_null( self::$instance ) ) {
|
|
|
|
self::$instance = new self;
|
|
|
|
}
|
|
|
|
return self::$instance;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setGallery( $marker, $content ) {
|
|
|
|
$this->galleries[$marker] = $content;
|
|
|
|
}
|
|
|
|
|
2015-06-19 12:16:07 +00:00
|
|
|
/**
|
|
|
|
* Retrieve source content of a gallery identified by Parser marker id
|
|
|
|
*/
|
2015-06-19 10:31:22 +00:00
|
|
|
public function getGallery( $marker ) {
|
2015-06-19 12:16:07 +00:00
|
|
|
if ( isset( $this->galleries[$marker] ) ) {
|
2015-06-19 10:31:22 +00:00
|
|
|
return $this->galleries[$marker];
|
|
|
|
}
|
2015-06-19 12:16:07 +00:00
|
|
|
|
|
|
|
return null;
|
2015-06-19 10:31:22 +00:00
|
|
|
}
|
|
|
|
}
|