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

SendRequest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Test Coverage

Coverage 63.64%

Importance

Changes 0
Metric Value
dl 0
loc 25
ccs 7
cts 11
cp 0.6364
rs 10
c 0
b 0
f 0
wmc 2
lcom 1
cbo 5

2 Methods

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