Passed
Push — master ( 64171d...4510f4 )
by Vladimir
10:35
created

Chat   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 36
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0
wmc 5
lcom 0
cbo 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getId() 0 4 1
A getTitle() 0 4 1
A getType() 0 4 1
A create() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace FondBot\Channels;
6
7
class Chat
8
{
9
    public const TYPE_PRIVATE = 'private';
10
    public const TYPE_GROUP = 'group';
11
12
    private $id;
13
    private $title;
14
    private $type;
15
16 30
    public function __construct(string $id, string $title = null, string $type = self::TYPE_PRIVATE)
17
    {
18 30
        $this->id = $id;
19 30
        $this->title = $title;
20 30
        $this->type = $type;
21 30
    }
22
23 3
    public static function create(string $id, string $title = null, string $type = self::TYPE_PRIVATE)
24
    {
25 3
        return new static($id, $title, $type);
26
    }
27
28 3
    public function getId(): string
29
    {
30 3
        return $this->id;
31
    }
32
33 1
    public function getTitle(): ?string
34
    {
35 1
        return $this->title;
36
    }
37
38 1
    public function getType(): string
39
    {
40 1
        return $this->type;
41
    }
42
}
43