3 namespace MediaWiki\Edit
;
5 use MediaWiki\Content\Content
;
6 use UnexpectedValueException
;
7 use Wikimedia\Parsoid\Core\PageBundle
;
8 use Wikimedia\Parsoid\Core\SelserData
;
11 * Value object representing contextual information needed by Parsoid for selective serialization ("selser") of
19 private PageBundle
$pageBundle;
23 private ?Content
$content;
26 * @param PageBundle $pageBundle
28 * @param Content|null $content
30 public function __construct( PageBundle
$pageBundle, int $revId, ?Content
$content = null ) {
31 if ( !$revId && !$content ) {
32 throw new UnexpectedValueException(
33 'If $revId is 0, $content must be given. ' .
34 'If we can\'t load the content from a revision, we have to stash it.'
38 $this->pageBundle
= $pageBundle;
39 $this->revId
= $revId;
40 $this->content
= $content;
46 public function getPageBundle(): PageBundle
{
47 return $this->pageBundle
;
53 public function getRevisionID(): int {
58 * @return Content|null
60 public function getContent(): ?Content
{
61 return $this->content
;