SitemapCrawlProfile   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 4
c 1
b 0
f 1
dl 0
loc 16
rs 10
wmc 2

1 Method

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