Code Duplication    Length = 38-40 lines in 2 locations

lib/Elements/Text.php 1 location

@@ 37-76 (lines=40) @@
34
 *
35
 * @author Julien Fastré <[email protected]>
36
 */
37
class Text extends AbstractElement
38
{
39
    /**
40
     *
41
     * @var CharacterString
42
     */
43
    private $content;
44
    
45
    public function __construct(CharacterString $content)
46
    {
47
        $this->setContent($content);
48
    }
49
50
    
51
    public function getContent()
52
    {
53
        return $this->content;
54
    }
55
56
    public function setContent(CharacterString $content)
57
    {
58
        $this->content = $content;
59
        
60
        return $this;
61
    }
62
63
        
64
    public function toDOMElement(\DOMDocument $doc): \DOMElement
65
    {
66
        $el = $this->createElement($doc);
67
        $el->appendChild($doc->createTextNode($this->getContent()->getContent()));
68
        
69
        return $el;
70
    }
71
72
    protected function getElementTag(): string
73
    {
74
        return 'text';
75
    }
76
}
77

lib/Elements/Title.php 1 location

@@ 36-73 (lines=38) @@
33
 *
34
 * @author Julien Fastré <[email protected]>
35
 */
36
class Title extends AbstractElement
37
{
38
    /**
39
     *
40
     * @var CharacterString
41
     */
42
    protected $string;
43
    
44
    public function __construct(CharacterString $string)
45
    {
46
        $this->setString($string);
47
    }
48
    
49
    public function getString()
50
    {
51
        return $this->string;
52
    }
53
54
    public function setString(CharacterString $string)
55
    {
56
        $this->string = $string;
57
        
58
        return $this;
59
    }
60
    
61
    protected function getElementTag()
62
    {
63
        return 'title';
64
    }
65
66
    public function toDOMElement(\DOMDocument $doc)
67
    {
68
        $el = $this->createElement($doc);
69
        $el->appendChild($doc->createTextNode($this->getString()->getContent()));
70
        
71
        return $el;
72
    }
73
}
74