Passed
Push — master ( c34c78...bc30de )
by kill
03:55
created

Dom::init()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
nc 1
nop 1
dl 0
loc 5
ccs 4
cts 4
cp 1
crap 1
rs 9.4285
c 1
b 0
f 0
1
<?php
2
/**
3
 * Created by rozbo at 2017/4/17 下午6:34
4
 */
5
6
namespace puck\helpers;
7
8
use DiDom\Document;
9
10
class Dom extends Document {
11 1
    public function __construct() {
12 1
        $this->init();
13 1
    }
14
15 3
    public function init($encoding = 'UTF-8') {
16 3
        $this->document = new \DOMDocument('1.0', $encoding);
17 3
        $this->preserveWhiteSpace(false);
18 3
        return $this;
19
    }
20
21 2
    public function release() {
22 2
        unset($this->document);
23 2
        return $this;
24
    }
25
}