Observer   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 36
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A willCrawl() 0 2 1
A finishedCrawling() 0 2 1
A __construct() 0 3 1
A hasBeenCrawled() 0 3 1
1
<?php
2
3
namespace safaeean\Sitemap\Crawler;
4
5
use safaeean\Crawler\Url;
0 ignored issues
show
Bug introduced by
The type safaeean\Crawler\Url was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use safaeean\Crawler\CrawlObserver;
0 ignored issues
show
Bug introduced by
The type safaeean\Crawler\CrawlObserver was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
8
class Observer implements CrawlObserver
9
{
10
    /** @var callable */
11
    protected $hasCrawled;
12
13
    public function __construct(callable $hasCrawled)
14
    {
15
        $this->hasCrawled = $hasCrawled;
16
    }
17
18
    /**
19
     * Called when the crawler will crawl the url.
20
     *
21
     * @param \safaeean\Crawler\Url $url
22
     */
23
    public function willCrawl(Url $url)
24
    {
25
    }
26
27
    /**
28
     * Called when the crawler has crawled the given url.
29
     *
30
     * @param \safaeean\Crawler\Url $url
31
     * @param \Psr\Http\Message\ResponseInterface|null $response
32
     * @param \safaeean\Crawler\Url $foundOnUrl
33
     */
34
    public function hasBeenCrawled(Url $url, $response, Url $foundOnUrl = null)
35
    {
36
        ($this->hasCrawled)($url, $response);
37
    }
38
39
    /**
40
     * Called when the crawl has ended.
41
     */
42
    public function finishedCrawling()
43
    {
44
    }
45
}
46