MediaWiki  master
PreparedEdit.php
Go to the documentation of this file.
1 <?php
21 namespace MediaWiki\Edit;
22 
23 use Content;
24 use ParserOptions;
25 use ParserOutput;
26 use RuntimeException;
27 
35 class PreparedEdit {
41  public $revid;
42 
48  public $pstContent;
49 
55  public $format;
56 
62  public $popts;
63 
69  private $canonicalOutput;
70 
76  public $newContent;
77 
83  public $oldContent;
84 
91 
95  public function getOutput() {
96  if ( !$this->canonicalOutput ) {
97  $this->canonicalOutput = call_user_func( $this->parserOutputCallback );
98  }
99 
100  return $this->canonicalOutput;
101  }
102 
110  public function __get( $name ) {
111  if ( $name === 'output' ) {
112  return $this->getOutput();
113  } elseif ( $name === 'timestamp' ) {
114  return $this->getOutput()->getCacheTime();
115  }
116 
117  throw new RuntimeException( "Undefined field $name." );
118  }
119 }
Represents information returned by WikiPage::prepareContentForEdit()
Content null $oldContent
Current content of the page, if any.
int null $revid
Revision ID.
ParserOptions $popts
Parser options used to get parser output.
__get( $name)
Fetch the ParserOutput via a lazy-loaded callback (for backwards compatibility).
Content $newContent
Content that is being saved (before PST)
string $format
Content format.
callable $parserOutputCallback
Lazy-loading callback to get canonical ParserOutput object.
Content null $pstContent
Content after going through pre-save transform.
Set options of the Parser.
Rendered output of a wiki page, as parsed from wikitext.
Base interface for representing page content.
Definition: Content.php:39