UptimeCheckFailed   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
dl 0
loc 33
rs 10
c 0
b 0
f 0
wmc 2
lcom 1
cbo 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A handle() 0 8 1
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