| Conditions | 7 | 
| Paths | 6 | 
| Total Lines | 35 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
| 1 | <?php | ||
| 22 | public function parse(DOMDocument $dom, DOMXPath $xpath) | ||
| 23 |     { | ||
| 24 |         $result = $xpath->query('//hr[contains(@class, "m-t-none")]'); | ||
| 25 |         if ($result->length < 1) { | ||
| 26 | return ''; | ||
| 27 | } | ||
| 28 | |||
| 29 | $text = []; | ||
| 30 |         for ($i = 0; $i < $result->length; $i++) { | ||
| 31 | $currentItem = $result->item($i); | ||
| 32 | $resultI = $currentItem->parentNode->childNodes; | ||
| 33 |             if ($currentItem->childNodes->length > 0) { | ||
| 34 | $resultI = $currentItem->childNodes; | ||
| 35 | } | ||
| 36 | |||
| 37 |             if ($resultI->length <= 0) { | ||
| 38 | continue; | ||
| 39 | } | ||
| 40 |             foreach ($resultI as $key => $node) { | ||
| 41 | $nodeText = trim($dom->saveXML($node)); | ||
| 42 | |||
| 43 |                 if (false !== strpos($nodeText, 'submit-your-session-button')) { | ||
| 44 | continue; | ||
| 45 | } | ||
| 46 | |||
| 47 |                 $nodeText = str_replace('</hr>', '', $nodeText); | ||
| 48 |                 $nodeText = str_replace('<hr class="m-t-none">', '', $nodeText); | ||
| 49 | $text[] = $nodeText; | ||
| 50 | } | ||
| 51 | } | ||
| 52 |         $description = trim(implode('', $text)); | ||
| 53 | $description = preg_replace(['/\<\!\-\-.*?\-\-\>/si', '/\<script.*?\<\/script\>/si', '/\<script.*?src=\".*?\/\>/'], '', $description); | ||
| 54 | |||
| 55 | return $description; | ||
| 56 | } | ||
| 57 | } | ||
| 58 |