| 1 |
<?php |
| 2 |
|
| 3 |
namespace MediaWiki\Tidy; |
| 4 |
|
| 5 |
use InvalidArgumentException; |
| 6 |
use Wikimedia\RemexHtml\Serializer\SerializerNode; |
| 7 |
use Wikimedia\RemexHtml\TreeBuilder\Element; |
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
class RemexMungerData { |
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
public $childPElement; |
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
public $ancestorPNode; |
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
public $wrapBaseNode; |
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
public $currentCloneElement; |
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
public $isPWrapper = false; |
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
public $isSplittable = false; |
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
public $needsPWrapping = false; |
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
public $nonblankNodeCount = 0; |
| 82 |
|
| 83 |
public function __set( $name, $value ) { |
| 84 |
|
| 85 |
throw new InvalidArgumentException( "Cannot set property \"$name\"" ); |
| 86 |
} |
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
public function dump() { |
| 95 |
$parts = []; |
| 96 |
|
| 97 |
if ( $this->childPElement ) { |
| 98 |
$parts[] = 'childPElement=' . $this->childPElement->getDebugTag(); |
| 99 |
} |
| 100 |
if ( $this->ancestorPNode ) { |
| 101 |
$parts[] = "ancestorPNode=<{$this->ancestorPNode->name}>"; |
| 102 |
} |
| 103 |
if ( $this->wrapBaseNode ) { |
| 104 |
$parts[] = "wrapBaseNode=<{$this->wrapBaseNode->name}>"; |
| 105 |
} |
| 106 |
if ( $this->currentCloneElement ) { |
| 107 |
$parts[] = "currentCloneElement=" . $this->currentCloneElement->getDebugTag(); |
| 108 |
} |
| 109 |
if ( $this->isPWrapper ) { |
| 110 |
$parts[] = 'isPWrapper'; |
| 111 |
} |
| 112 |
if ( $this->isSplittable ) { |
| 113 |
$parts[] = 'isSplittable'; |
| 114 |
} |
| 115 |
if ( $this->needsPWrapping ) { |
| 116 |
$parts[] = 'needsPWrapping'; |
| 117 |
} |
| 118 |
if ( $this->nonblankNodeCount ) { |
| 119 |
$parts[] = "nonblankNodeCount={$this->nonblankNodeCount}"; |
| 120 |
} |
| 121 |
$s = "RemexMungerData {\n"; |
| 122 |
foreach ( $parts as $part ) { |
| 123 |
$s .= " $part\n"; |
| 124 |
} |
| 125 |
$s .= "}\n"; |
| 126 |
return $s; |
| 127 |
} |
| 128 |
} |