SendAttachment::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 6
c 0
b 0
f 0
ccs 5
cts 5
cp 1
rs 10
cc 1
nc 1
nop 4
crap 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