| @@ 123-138 (lines=16) @@ | ||
| 120 | * @param \DOMElement $element |
|
| 121 | * @param int $maxLength |
|
| 122 | */ |
|
| 123 | private function addRandomP(\DOMElement $element, $maxLength = 50) |
|
| 124 | { |
|
| 125 | $p = $element->ownerDocument->createElement(static::P_TAG); |
|
| 126 | $text = $element->ownerDocument->createTextNode($this->getSentence(mt_rand(1, $maxLength))); |
|
| 127 | // left-aligned paragraphs have double frequency |
|
| 128 | switch (mt_rand(1, 4)) { |
|
| 129 | case 1: |
|
| 130 | $p->setAttribute("ezxhtml:textalign", "right"); |
|
| 131 | break; |
|
| 132 | case 2: |
|
| 133 | $p->setAttribute("ezxhtml:textalign", "center"); |
|
| 134 | break; |
|
| 135 | } |
|
| 136 | $p->appendChild($text); |
|
| 137 | $element->appendChild($p); |
|
| 138 | } |
|
| 139 | ||
| 140 | private function addRandomA(\DOMElement $element, $maxLength = 10) |
|
| 141 | { |
|
| @@ 122-137 (lines=16) @@ | ||
| 119 | * @param \DOMElement $element |
|
| 120 | * @param int $maxLength |
|
| 121 | */ |
|
| 122 | private function addRandomP(\DOMElement $element, $maxLength = 50) |
|
| 123 | { |
|
| 124 | $p = $element->ownerDocument->createElement(static::P_TAG); |
|
| 125 | $text = $element->ownerDocument->createTextNode($this->getSentence(mt_rand(1, $maxLength))); |
|
| 126 | // left-aligned paragraphs have double frequency |
|
| 127 | switch (mt_rand(1, 4)) { |
|
| 128 | case 1: |
|
| 129 | $p->setAttribute("align", "right"); |
|
| 130 | break; |
|
| 131 | case 2: |
|
| 132 | $p->setAttribute("align", "center"); |
|
| 133 | break; |
|
| 134 | } |
|
| 135 | $p->appendChild($text); |
|
| 136 | $element->appendChild($p); |
|
| 137 | } |
|
| 138 | ||
| 139 | private function addRandomA(\DOMElement $element, $maxLength = 10) |
|
| 140 | { |
|