CrawlerRestart   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 1
Metric Value
eloc 8
dl 0
loc 26
ccs 13
cts 13
cp 1
rs 10
c 2
b 0
f 1
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 19 2
A resetLinks() 0 3 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