Conditions | 2 |
Paths | 2 |
Total Lines | 17 |
Code Lines | 12 |
Lines | 11 |
Ratio | 64.71 % |
Tests | 14 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
16 | 2 | public function parse(StreamInterface $data = null) |
|
17 | { |
||
18 | 2 | $ips = explode("\n", $this->getStreamData($data)->getContents()); |
|
19 | 2 | $ips = array_filter($ips, 'ip2long'); |
|
20 | 2 | View Code Duplication | if (count($ips) < $this->getParseWarningThreshold()) { |
|
|||
21 | 1 | $this->logger->warning( |
|
22 | 1 | 'Number of Tor exit nodes found when parsing is low.', |
|
23 | 1 | ['exit-node-count' => count($ips)] |
|
24 | 1 | ); |
|
25 | 1 | } else { |
|
26 | 1 | $this->logger->info( |
|
27 | 1 | 'Tor exit nodes parsed from blutmagie.de', |
|
28 | 1 | ['exit-node-count' => count($ips)] |
|
29 | 1 | ); |
|
30 | } |
||
31 | 2 | return new IpList($ips); |
|
32 | } |
||
33 | } |
||
34 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.