| Conditions | 4 |
| Paths | 4 |
| Total Lines | 19 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 13 | 16 | public function onProcessLinksBefore(CommandEvent $event) |
|
| 14 | { |
||
| 15 | 16 | if (!$event->getCommand() instanceof ProcessLinks) { |
|
| 16 | 14 | return; |
|
| 17 | } |
||
| 18 | |||
| 19 | 2 | $links = []; |
|
| 20 | 2 | foreach ($event->getCommand()->getLinks() as $link) { |
|
| 21 | 2 | $downloader = $this->getDownloader($link); |
|
| 22 | 2 | if (empty($downloader)) { |
|
| 23 | 1 | $links[] = $link; |
|
| 24 | 1 | continue; |
|
| 25 | } |
||
| 26 | |||
| 27 | 1 | $links = array_merge($links, $downloader->fetchLinkList($link)); |
|
| 28 | } |
||
| 29 | |||
| 30 | 2 | $event->setCommand(new ProcessLinks(array_unique($links))); |
|
| 31 | 2 | } |
|
| 32 | } |
||
| 33 |