CrawlerRestart::resetLinks()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace PiedWeb\SeoPocketCrawler;
4
5
class CrawlerRestart extends CrawlerContinue
6
{
7
    public function __construct(
8
        string $id,
9
        bool $fromCache = false,
10 3
        bool $debug = true,
11
        ?string $dataDirectory = null
12 3
    ) {
13
        if (true === $fromCache) {
14 3
            $this->harvester = '\PiedWeb\SeoPocketCrawler\CrawlerUrlFromCache';
15
        }
16 3
17 3
        $this->config = CrawlerConfig::loadFrom($id, $dataDirectory);
18
19 3
        $this->resetLinks();
20
21 3
        //$this->recorder = new Recorder($this->config->getDataFolder(), $this->config->getCacheMethod());
22 3
23 3
        $this->urls[$this->config->getStartUrl()] = null;
24
25 3
        $this->debug = $debug;
26
    }
27 3
28 3
    protected function resetLinks()
29
    {
30 3
        exec('rm -rf '.$this->config->getDataFolder().Recorder::LINKS_DIR);
31
    }
32
}
33