Completed
Push — master ( 091fb5...12e396 )
by Vladimir
02:33
created

SendRequest::handle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 5
ccs 0
cts 4
cp 0
crap 2
rs 9.4285
c 0
b 0
f 0
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 Illuminate\Queue\InteractsWithQueue;
12
use Illuminate\Contracts\Queue\ShouldQueue;
13
use Illuminate\Foundation\Bus\Dispatchable;
14
15
class SendRequest implements ShouldQueue
16
{
17
    use InteractsWithQueue, Queueable, Dispatchable;
18
19
    private $channel;
20
    private $chat;
21
    private $recipient;
22
    private $endpoint;
23
    private $parameters;
24
25 2
    public function __construct(Channel $channel, Chat $chat, User $recipient, string $endpoint, array $parameters = [])
26
    {
27 2
        $this->channel = $channel;
28 2
        $this->chat = $chat;
29 2
        $this->recipient = $recipient;
30 2
        $this->endpoint = $endpoint;
31 2
        $this->parameters = $parameters;
32 2
    }
33
34
    public function handle(): void
35
    {
36
        $driver = $this->channel->getDriver();
37
        $driver->sendRequest($this->chat, $this->recipient, $this->endpoint, $this->parameters);
38
    }
39
}
40