GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 1c7f7f...f34d69 )
by Sebastian
04:18
created

Observer::crawled()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.9332
c 0
b 0
f 0
cc 1
nc 1
nop 3
1
<?php
2
3
namespace Spatie\Export\Crawler;
4
5
use GuzzleHttp\Exception\RequestException;
6
use Psr\Http\Message\ResponseInterface;
7
use Psr\Http\Message\UriInterface;
8
use Spatie\Crawler\CrawlObserver;
9
use Spatie\Export\Destination;
10
11
class Observer extends CrawlObserver
12
{
13
    /** @var \Spatie\Export\Destination */
14
    protected $destination;
15
16
    /** @var string */
17
    protected $entry;
18
19
    public function __construct(Destination $destination, string $entry)
20
    {
21
        $this->destination = $destination;
22
23
        $this->entry = $entry;
24
    }
25
26
    public function crawled(UriInterface $url, ResponseInterface $response, ?UriInterface $foundOnUrl = null)
27
    {
28
        $contents = str_replace($this->entry.'/', '/', $response->getBody());
29
        $contents = str_replace($this->entry, '/', $contents);
30
31
        $this->destination->write(
32
            ltrim($url->getPath().'/index.html', '/'),
33
            $contents
34
        );
35
    }
36
37
    public function crawlFailed(UriInterface $url, RequestException $requestException, ?UriInterface $foundOnUrl = null)
38
    {
39
        throw $requestException;
40
    }
41
}
42