CrawlObserver   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
crawled() 0 5 ?
crawlFailed() 0 5 ?
A willCrawl() 0 3 1
A finishedCrawling() 0 3 1
1
<?php
2
3
namespace Spatie\Crawler;
4
5
use GuzzleHttp\Exception\RequestException;
6
use Psr\Http\Message\ResponseInterface;
7
use Psr\Http\Message\UriInterface;
8
9
abstract class CrawlObserver
10
{
11
    /**
12
     * Called when the crawler will crawl the url.
13
     *
14
     * @param \Psr\Http\Message\UriInterface $url
15
     */
16
    public function willCrawl(UriInterface $url)
0 ignored issues
show
Unused Code introduced by
The parameter $url is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
17
    {
18
    }
19
20
    /**
21
     * Called when the crawler has crawled the given url successfully.
22
     *
23
     * @param \Psr\Http\Message\UriInterface $url
24
     * @param \Psr\Http\Message\ResponseInterface $response
25
     * @param \Psr\Http\Message\UriInterface|null $foundOnUrl
26
     */
27
    abstract public function crawled(
28
        UriInterface $url,
29
        ResponseInterface $response,
30
        ?UriInterface $foundOnUrl = null
31
    );
32
33
    /**
34
     * Called when the crawler had a problem crawling the given url.
35
     *
36
     * @param \Psr\Http\Message\UriInterface $url
37
     * @param \GuzzleHttp\Exception\RequestException $requestException
38
     * @param \Psr\Http\Message\UriInterface|null $foundOnUrl
39
     */
40
    abstract public function crawlFailed(
41
        UriInterface $url,
42
        RequestException $requestException,
43
        ?UriInterface $foundOnUrl = null
44
    );
45
46
    /**
47
     * Called when the crawl has ended.
48
     */
49
    public function finishedCrawling()
50
    {
51
    }
52
}
53