UptimeCheckFailed::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 2
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Transmissor\Jobs\Webhook;
4
5
use Transmissor\Models\User;
6
use BotMan\Drivers\Telegram\TelegramDriver;
7
use Illuminate\Bus\Queueable;
8
use Illuminate\Contracts\Queue\ShouldQueue;
9
use Illuminate\Foundation\Bus\Dispatchable;
10
use Illuminate\Queue\InteractsWithQueue;
11
use Illuminate\Queue\SerializesModels;
12
13
class UptimeCheckFailed implements ShouldQueue
14
{
15
16
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
17
18
    public $payload;
19
20
    /**
21
     * @var \BotMan\BotMan\BotMan 
22
     */
23
    public $botman;
24
25
    /**
26
     * @var \Transmissor\Models\User 
27
     */
28
    public $user;
29
30
    public function __construct($payload, User $user)
31
    {
32
        $this->payload = $payload;
33
        $this->user = $user;
34
        $this->botman = resolve('botman');
35
    }
36
37
    public function handle()
38
    {
39
        $this->botman->say(
40
            trans('Transmissor.webhook.uptime_check_failed', ['url' => $this->payload->site->url]),
41
            $this->user->telegram_id,
42
            TelegramDriver::class
43
        );
44
    }
45
}
46