| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
> |
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
class DumpMultiWriter { |
| 30 |
|
| 31 |
private $sinks; |
| 32 |
|
| 33 |
private $count; |
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
public function __construct( $sinks ) { |
| 39 |
$this->sinks = $sinks; |
| 40 |
$this->count = count( $sinks ); |
| 41 |
} |
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
public function writeOpenStream( $string ) { |
| 47 |
for ( $i = 0; $i < $this->count; $i++ ) { |
| 48 |
$this->sinks[$i]->writeOpenStream( $string ); |
| 49 |
} |
| 50 |
} |
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
public function writeCloseStream( $string ) { |
| 56 |
for ( $i = 0; $i < $this->count; $i++ ) { |
| 57 |
$this->sinks[$i]->writeCloseStream( $string ); |
| 58 |
} |
| 59 |
} |
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
public function writeOpenPage( $page, $string ) { |
| 66 |
for ( $i = 0; $i < $this->count; $i++ ) { |
| 67 |
$this->sinks[$i]->writeOpenPage( $page, $string ); |
| 68 |
} |
| 69 |
} |
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
public function writeClosePage( $string ) { |
| 75 |
for ( $i = 0; $i < $this->count; $i++ ) { |
| 76 |
$this->sinks[$i]->writeClosePage( $string ); |
| 77 |
} |
| 78 |
} |
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
public function writeRevision( $rev, $string ) { |
| 85 |
for ( $i = 0; $i < $this->count; $i++ ) { |
| 86 |
$this->sinks[$i]->writeRevision( $rev, $string ); |
| 87 |
} |
| 88 |
} |
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
public function closeRenameAndReopen( $newnames ) { |
| 94 |
$this->closeAndRename( $newnames, true ); |
| 95 |
} |
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
public function closeAndRename( $newnames, $open = false ) { |
| 102 |
for ( $i = 0; $i < $this->count; $i++ ) { |
| 103 |
$this->sinks[$i]->closeAndRename( $newnames[$i], $open ); |
| 104 |
} |
| 105 |
} |
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
public function getFilenames() { |
| 111 |
$filenames = []; |
| 112 |
for ( $i = 0; $i < $this->count; $i++ ) { |
| 113 |
$filenames[] = $this->sinks[$i]->getFilenames(); |
| 114 |
} |
| 115 |
return $filenames; |
| 116 |
} |
| 117 |
} |