Passed
Push — master ( bdfc9e...6300bb )
by Vladimir
02:22
created

User::make()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 4
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace FondBot\Channels;
6
7
use Illuminate\Support\Collection;
8
9
class User
10
{
11
    private $id;
12
    private $name;
13
    private $username;
14
    private $data;
15
16 31
    protected function __construct(string $id, string $name = null, string $username = null, array $data = [])
17
    {
18 31
        $this->id = $id;
19 31
        $this->name = $name;
20 31
        $this->username = $username;
21 31
        $this->data = collect($data);
22 31
    }
23
24 31
    public static function make(string $id, string $name = null, string $username = null, array $data = [])
25
    {
26 31
        return new static($id, $name, $username, $data);
27
    }
28
29 4
    public function getId(): string
30
    {
31 4
        return $this->id;
32
    }
33
34 2
    public function getName(): ?string
35
    {
36 2
        return $this->name;
37
    }
38
39 2
    public function getUsername(): ?string
40
    {
41 2
        return $this->username;
42
    }
43
44
    /**
45
     * Additional user information.
46
     *
47
     * @return Collection
48
     */
49 1
    public function getData(): Collection
50
    {
51 1
        return $this->data;
52
    }
53
}
54