Rsdf   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 8
c 0
b 0
f 0
lcom 0
cbo 1
dl 0
loc 40
ccs 22
cts 22
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
C getLinks() 0 36 8
1
<?php
2
namespace Tartana\Component\Decrypter;
3
4
class Rsdf extends BaseDecrypter
5
{
6
7 5
	public function getLinks($content)
8
	{
9 5
		$key = pack('H*', "8C35192D964DC3182C6F84F3252239EB4A320D2500000000");
10 5
		$iv = pack('H*', "a3d5a33cb95ac1f5cbdb1ad25cb0a7aa");
11 5
		$cipher = @mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', MCRYPT_MODE_CFB, '');
12 5
		@mcrypt_generic_init($cipher, $key, $iv);
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
13
14 5
		$content = @pack('H*', $content);
15
16 5
		$links = [];
17 5
		if (stripos($content, "\xDA") !== false) {
18 1
			$links = explode("\xDA", $content);
19 4
		} elseif (stripos($content, "\n") !== false) {
20 3
			$links = explode("\n", $content);
21
		}
22
23 5
		$urls = [];
24 5
		foreach ($links as $link) {
25 4
			if (empty($link)) {
26 4
				continue;
27
			}
28
29 4
			$text = @mdecrypt_generic($cipher, base64_decode($link));
30 4
			if (empty($text)) {
31 1
				continue;
32
			}
33
34 3
			$urls[] = $text;
35
		}
36
37 5
		if (empty($urls) && error_get_last()) {
38 2
			throw new \RuntimeException(error_get_last()['message']);
39
		}
40
41 3
		return $urls;
42
	}
43
}
44