Code Duplication    Length = 25-25 lines in 2 locations

src/Engines/Google.php 1 location

@@ 40-64 (lines=25) @@
37
38
            $this->output('Page '.$count."\n");
39
40
            if ($this->commandData['virginProxies']) {
41
                $body = Utils::getBodyByVirginProxies($urlOfSearch, $this->listOfVirginProxies[$countProxyVirgin], $this->proxy);
42
43
                //Check if exist captcha
44
                //Check if next group of return data or not
45
                $arrLinks = array();
46
                if (!$this->checkCaptcha($body) and $body != 'repeat') {
47
                    $arrLinks = Utils::getLinks($body);
48
                } else {
49
                    --$count;
50
                    $countProxyFail[$countProxyVirgin] = $this->listOfVirginProxies[$countProxyVirgin];
51
52
                    $this->output("You has a problem with proxy, probaly you estress the engenier ...\n");
53
                }
54
55
                //Check if next virgin proxy or repeat of 0
56
                if ($countProxyVirgin == count($this->listOfVirginProxies) - 1) {
57
                    $countProxyVirgin = 0;
58
                } else {
59
                    ++$countProxyVirgin;
60
                }
61
            } else {
62
                $body = $this->getBody($urlOfSearch);
63
                $arrLinks = Utils::getLinks($body);
64
            }
65
66
            $this->output("\n".$urlOfSearch."\n");
67

src/Engines/Yandex.php 1 location

@@ 34-58 (lines=25) @@
31
32
            $this->output('Page '.$count."\n");
33
34
            if ($this->commandData['virginProxies']) {
35
                $body = Utils::getBodyByVirginProxies($urlOfSearch, $this->listOfVirginProxies[$countProxyVirgin], $this->proxy);
36
37
                //Check if next group of return data or not
38
                $arrLinks = array();
39
                if (!$this->checkCaptcha($body) and $body != 'repeat') {
40
                    $arrLinks = Utils::getLinks($body);
41
                } else {
42
                    --$count;
43
                    //Count the proxys with fail and all fail proxys, finish action
44
                    $countProxyFail[$countProxyVirgin] = $this->listOfVirginProxies[$countProxyVirgin];
45
                    $this->output("You has a problem with proxy, probaly you estress the engenier ...\n");
46
                }
47
48
                //Check if next virgin proxy or repeat of 0
49
                if ($countProxyVirgin == count($this->listOfVirginProxies) - 1) {
50
                    $countProxyVirgin = 0;
51
                } else {
52
                    ++$countProxyVirgin;
53
                }
54
            } else {
55
                $body = Utils::getBody($urlOfSearch, $this->proxy);
56
57
                $arrLinks = Utils::getLinks($body);
58
            }
59
60
            $this->output("\n".$urlOfSearch."\n");
61