Conditions | 8 |
Paths | 24 |
Total Lines | 36 |
Code Lines | 22 |
Lines | 0 |
Ratio | 0 % |
Tests | 22 |
CRAP Score | 8 |
Changes | 0 |
1 | <?php |
||
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); |
|
|
|||
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 |
If you suppress an error, we recommend checking for the error condition explicitly: