SendAttachment   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 66.67%

Importance

Changes 0
Metric Value
wmc 2
eloc 12
dl 0
loc 21
c 0
b 0
f 0
ccs 6
cts 9
cp 0.6667
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A handle() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace FondBot\Foundation\Commands;
6
7
use FondBot\Channels\Chat;
8
use FondBot\Channels\User;
9
use FondBot\Channels\Channel;
10
use Illuminate\Bus\Queueable;
11
use FondBot\Templates\Attachment;
12
use Illuminate\Queue\InteractsWithQueue;
13
use Illuminate\Contracts\Queue\ShouldQueue;
14
use Illuminate\Foundation\Bus\Dispatchable;
15
16
class SendAttachment implements ShouldQueue
17
{
18
    use InteractsWithQueue, Queueable, Dispatchable;
19
20
    private $channel;
21
    private $chat;
22
    private $recipient;
23
    private $attachment;
24
25 3
    public function __construct(Channel $channel, Chat $chat, User $recipient, Attachment $attachment)
26
    {
27 3
        $this->channel = $channel;
28 3
        $this->chat = $chat;
29 3
        $this->recipient = $recipient;
30 3
        $this->attachment = $attachment;
31 3
    }
32
33
    public function handle(): void
34
    {
35
        $driver = $this->channel->getDriver();
36
        $driver->sendAttachment($this->chat, $this->recipient, $this->attachment);
37
    }
38
}
39