Completed
Push — master ( 48abf8...8f7739 )
by C
13:50
created

Txt   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
c 1
b 0
f 0
lcom 0
cbo 2
dl 0
loc 25
ccs 11
cts 11
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B getLinks() 0 21 5
1
<?php
2
namespace Tartana\Component\Decrypter;
3
use Tartana\Util;
4
5
class Txt extends BaseDecrypter
6
{
7
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
}