| Conditions | 5 |
| Paths | 6 |
| Total Lines | 18 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 5 |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | 4 | public function getLinks($content) |
|
| 10 | { |
||
| 11 | 4 | $mustUnset = false; |
|
| 12 | 4 | $links = explode(PHP_EOL, $content); |
|
| 13 | 4 | foreach ($links as $key => $link) { |
|
| 14 | 4 | $uri = Util::parseUrl($link); |
|
| 15 | 4 | if (!$uri['scheme']) { |
|
| 16 | 2 | unset($links[$key]); |
|
| 17 | 4 | $mustUnset = true; |
|
| 18 | } |
||
| 19 | } |
||
| 20 | |||
| 21 | 4 | if ($mustUnset && empty($links)) { |
|
| 22 | 2 | throw new \RuntimeException('Invalid content'); |
|
| 23 | } |
||
| 24 | |||
| 25 | 2 | return $links; |
|
| 26 | } |
||
| 27 | } |
||
| 28 |