SitemapCrawlProfile::shouldCrawl()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 2
eloc 3
c 1
b 0
f 1
nc 2
nop 1
dl 0
loc 7
rs 10
1
<?php
2
3
namespace App\Services;
4
5
use Psr\Http\Message\UriInterface;
6
use Spatie\Crawler\CrawlProfile;
7
8
class SitemapCrawlProfile extends CrawlProfile
9
{
10
    /**
11
     * Sitemap Cralwer Custom Crawl Profile.
12
     *
13
     * @param \Psr\Http\Message\UriInterface $url
14
     *
15
     * @return bool
16
     */
17
    public function shouldCrawl(UriInterface $url): bool
18
    {
19
        if ($url->getHost() !== 'localhost') {
20
            return false;
21
        }
22
23
        return $url->getPath() === '/';
24
    }
25
}
26