Conditions | 2 |
Paths | 2 |
Total Lines | 19 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 13 |
CRAP Score | 2 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
14 | 39 | public function find($surah, array $ayah) |
|
15 | { |
||
16 | 39 | $xml = new \SimpleXMLElement($this->xml); |
|
17 | |||
18 | 39 | $xpath = '//sura[@index=' . $surah . ']/aya[' . implode(' or ', array_map(function ($a) { |
|
19 | 39 | return '@index=' . $a; |
|
20 | 39 | }, $ayah)) . ']'; |
|
21 | |||
22 | 39 | $xpathResult = $xml->xpath($xpath); |
|
23 | 39 | $result = []; |
|
24 | |||
25 | 39 | while (list(, $node) = each($xpathResult)) { |
|
26 | 39 | $node = (array)$node; |
|
27 | 39 | $verse = current($node); |
|
28 | 39 | $result[$verse['index']] = $verse['text']; |
|
29 | 39 | } |
|
30 | |||
31 | 39 | return $result; |
|
32 | } |
||
33 | |||
42 | } |