Passed
Push — master ( acf3f9...98cfe3 )
by Derek Stephen
03:04
created

HasDomTrait::getDom()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 1
c 1
b 0
f 1
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 * User: delboy1978uk
4
 * Date: 27/12/2016
5
 * Time: 00:27
6
 */
7
8
namespace Del\Form\Traits;
9
10
use DOMDocument;
11
use DOMElement;
12
use DOMText;
13
14
trait HasDomTrait
15
{
16
    /** @var DOMDocument $dom  */
17
    private $dom;
18
19
    /**
20
     * @param $tagType
21
     * @return DOMElement
22
     */
23 34
    public function createElement($tagType)
24
    {
25 34
        return $this->dom->createElement($tagType);
26
    }
27
28
    /**
29
     * @param $text
30
     * @return DOMText
31
     */
32 25
    public function createText($text)
33
    {
34 25
        return new DOMText($text);
35
    }
36
37
    /**
38
     * @return DOMElement
39
     */
40 3
    public function createLineBreak()
41
    {
42 3
        return $this->createElement('br');
43
    }
44
45
    /**
46
     * @return DOMDocument
47
     */
48 66
    public function getDom()
49
    {
50 66
        return $this->dom;
51
    }
52
53
    /**
54
     * @param DOMDocument $dom
55
     * @return $this
56
     */
57 66
    public function setDom($dom)
58
    {
59 66
        $this->dom = $dom;
60 66
        return $this;
61
    }
62
}