Completed
Push — master ( b1ef3d...54d3e2 )
by Freek
01:12
created

MixedContentScanner::useCrawlProfile()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace Spatie\MixedContentScanner;
4
5
use Spatie\Crawler\Crawler;
6
use Spatie\Crawler\CrawlProfile;
7
use Spatie\Crawler\CrawlInternalUrls;
8
9
class MixedContentScanner
10
{
11
    /** @var \Spatie\MixedContentScanner\MixedContentObserver */
12
    public $mixedContentObserver;
13
14
    /** @var null|\Spatie\Crawler\CrawlProfile */
15
    public $crawlProfile;
16
17
    public function __construct(MixedContentObserver $mixedContentObserver)
18
    {
19
        $this->mixedContentObserver = $mixedContentObserver;
20
    }
21
22
    public function scan(string $url, array $clientOptions = [])
23
    {
24
        Crawler::create($clientOptions)
25
            ->setCrawlProfile($this->crawlProfile ?? new CrawlInternalUrls($url))
26
            ->setCrawlObserver($this->mixedContentObserver)
27
            ->startCrawling($url);
28
    }
29
30
    public function useCrawlProfile(CrawlProfile $crawlProfile)
31
    {
32
        $this->crawlProfile = $crawlProfile;
33
    }
34
}
35