Passed
Push — master ( a04653...8de31e )
by Vladimir
02:17
created

Channel   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 80%

Importance

Changes 0
Metric Value
dl 0
loc 41
ccs 8
cts 10
cp 0.8
rs 10
c 0
b 0
f 0
wmc 4
lcom 1
cbo 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getName() 0 4 1
A getDriver() 0 4 1
A getWebhookUrl() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace FondBot\Channels;
6
7
class Channel
8
{
9
    private $name;
10
    private $driver;
11
12 1
    public function __construct(string $name, Driver $driver)
13
    {
14 1
        $this->name = $name;
15 1
        $this->driver = $driver;
16 1
    }
17
18
    /**
19
     * Name of the channel.
20
     *
21
     * @return string
22
     */
23 1
    public function getName(): string
24
    {
25 1
        return $this->name;
26
    }
27
28
    /**
29
     * Get driver.
30
     *
31
     * @return Driver
32
     */
33 1
    public function getDriver(): Driver
34
    {
35 1
        return $this->driver;
36
    }
37
38
    /**
39
     * Get webhook URL.
40
     *
41
     * @return string
42
     */
43
    public function getWebhookUrl(): string
44
    {
45
        return route('fondbot.webhook', $this->name);
0 ignored issues
show
Documentation introduced by
$this->name is of type string, but the function expects a array.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
46
    }
47
}
48