Completed
Pull Request — master (#104)
by
unknown
01:24
created

Profile::shouldCrawlCallback()   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\Sitemap\Crawler;
4
5
use Spatie\Crawler\Url;
6
use Spatie\Crawler\CrawlProfile;
7
8
class Profile implements CrawlProfile
9
{
10
    /** @var callable */
11
    protected $profile;
12
13
    public function shouldCrawlCallback(callable $callback)
14
    {
15
        $this->profile = $callback;
16
    }
17
18
    /*
19
     * Determine if the given url should be crawled.
20
     */
21
    public function shouldCrawl(Url $url): bool
22
    {
23
        return ($this->profile)($url);
24
    }
25
}
26