These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Spatie\LinkChecker\Reporters; |
||
4 | |||
5 | use Spatie\Crawler\Url; |
||
6 | use Illuminate\Contracts\Mail\Mailer; |
||
7 | |||
8 | class MailBrokenLinks extends BaseReporter |
||
9 | { |
||
10 | /** |
||
11 | * @var Mailer |
||
12 | */ |
||
13 | protected $mail; |
||
14 | |||
15 | /** |
||
16 | * MailBrokenLinks constructor. |
||
17 | * |
||
18 | * @param \Illuminate\Contracts\Mail\Mailer $mail |
||
19 | */ |
||
20 | public function __construct(Mailer $mail) |
||
21 | { |
||
22 | $this->mail = $mail; |
||
23 | } |
||
24 | |||
25 | /** |
||
26 | * Called when the crawler has crawled the given url. |
||
27 | * |
||
28 | * @param \Spatie\Crawler\Url $url |
||
29 | * @param \Psr\Http\Message\ResponseInterface|null $response |
||
30 | * @param \Spatie\Crawler\Url $foundOnUrl |
||
31 | * |
||
32 | * @return string |
||
33 | */ |
||
34 | public function hasBeenCrawled(Url $url, $response, Url $foundOnUrl = null) |
||
35 | { |
||
36 | $url->foundOnUrl = $foundOnUrl; |
||
0 ignored issues
–
show
|
|||
37 | |||
38 | return parent::hasBeenCrawled($url, $response, $foundOnUrl); |
||
39 | } |
||
40 | |||
41 | /** |
||
42 | * Called when the crawl has ended. |
||
43 | */ |
||
44 | public function finishedCrawling() |
||
45 | { |
||
46 | if (!$this->crawledBadUrls()) { |
||
47 | return; |
||
48 | } |
||
49 | |||
50 | $urlsGroupedByStatusCode = $this->urlsGroupedByStatusCode; |
||
51 | |||
52 | $this->mail->send('laravel-link-checker::crawlReport', compact('urlsGroupedByStatusCode'), function ($message) { |
||
53 | $message->from(config('laravel-link-checker.reporters.mail.from_address')); |
||
54 | $message->to(config('laravel-link-checker.reporters.mail.to_address')); |
||
55 | $message->subject(config('laravel-link-checker.reporters.mail.subject')); |
||
56 | }); |
||
57 | } |
||
58 | } |
||
59 |
An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.
If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.