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