Completed
Pull Request — master (#104)
by
unknown
05:28
created

Profile   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 18
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A shouldCrawl() 0 4 1
A shouldCrawlCallback() 0 4 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