Code Duplication    Length = 16-16 lines in 2 locations

Faker/Provider/XmlText.php 1 location

@@ 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
    {

Faker/Provider/RichText.php 1 location

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