Passed
Push — master ( 9a5e09...c4d015 )
by Faiz
06:53
created

XML   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
dl 0
loc 23
ccs 11
cts 11
cp 1
rs 10
c 1
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A pathToXML() 0 7 1
A __construct() 0 3 1
A find() 0 5 1
1
<?php
2
3
namespace FaizShukri\Quran\Supports;
4
5
class XML
6
{
7
    private $xml;
8
9 64
    public function __construct($xmlPath)
10
    {
11 64
        $this->xml = $this->pathToXML($xmlPath);
12 32
    }
13
14 62
    public function find($xpath)
15
    {
16 62
        $xml = new \SimpleXMLElement($this->xml);
17
18 62
        return $xml->xpath($xpath);
19
    }
20
21 64
    public function pathToXML($xmlPath)
22
    {
23 64
        $xml = fopen($xmlPath, 'r');
24 64
        $res = fread($xml, filesize($xmlPath));
25 64
        fclose($xml);
26
27 64
        return $res;
28
    }
29
}
30