MediaWiki  master
ImportStringSource.php
Go to the documentation of this file.
1 <?php
34 class ImportStringSource implements ImportSource {
36  private $mString;
37 
39  private $mRead = false;
40 
44  public function __construct( $string ) {
45  $this->mString = $string;
46  }
47 
51  public function atEnd() {
52  return $this->mRead;
53  }
54 
58  public function readChunk() {
59  if ( $this->atEnd() ) {
60  return false;
61  }
62  $this->mRead = true;
63  return $this->mString;
64  }
65 
69  public function isSeekable() {
70  return true;
71  }
72 
77  public function seek( int $offset ) {
78  $this->mRead = false;
79  return 0;
80  }
81 }
Used for importing XML dumps where the content of the dump is in a string.
Source interface for XML import.