CrawlerRestart::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 19
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 2

Importance

Changes 2
Bugs 0 Features 1
Metric Value
cc 2
eloc 6
nc 2
nop 4
dl 0
loc 19
ccs 10
cts 10
cp 1
crap 2
rs 10
c 2
b 0
f 1
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