GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

UserBuilder   A
last analyzed

Complexity

Total Complexity 10

Size/Duplication

Total Lines 66
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
eloc 21
c 3
b 0
f 0
dl 0
loc 66
ccs 25
cts 25
cp 1
rs 10
wmc 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A setFirstName() 0 5 1
A setUsername() 0 5 1
A setNickname() 0 5 1
A setEmail() 0 5 1
A setLastName() 0 5 1
A getRequiredFields() 0 10 4
A setPassword() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Pnz\MattermostClient\Model\User;
6
7
use Pnz\MattermostClient\Model\ModelBuilder;
8
9
class UserBuilder extends ModelBuilder
10
{
11 2
    public function setEmail(string $email): self
12
    {
13 2
        $this->params['email'] = $email;
14
15 2
        return $this;
16
    }
17
18 2
    public function setUsername(string $username): self
19
    {
20 2
        $this->params['username'] = $username;
21
22 2
        return $this;
23
    }
24
25
    /**
26
     * Set the user password.
27
     */
28 2
    public function setPassword(string $password): self
29
    {
30 2
        $this->params['password'] = $password;
31
32 2
        return $this;
33
    }
34
35
    /**
36
     * Set the user first name.
37
     */
38 1
    public function setFirstName(string $firstName): self
39
    {
40 1
        $this->params['first_name'] = $firstName;
41
42 1
        return $this;
43
    }
44
45
    /**
46
     * Set the user last name.
47
     */
48 1
    public function setLastName(string $lastName): self
49
    {
50 1
        $this->params['last_name'] = $lastName;
51
52 1
        return $this;
53
    }
54
55
    /**
56
     * Set the user's nickname.
57
     */
58 1
    public function setNickname(string $nickname): self
59
    {
60 1
        $this->params['nickname'] = $nickname;
61
62 1
        return $this;
63
    }
64
65 5
    protected function getRequiredFields(string $buildType = self::BUILD_FOR_CREATE): array
66
    {
67
        switch ($buildType) {
68 5
            case self::BUILD_FOR_CREATE:
69 3
                return ['username', 'email', 'password'];
70 2
            case self::BUILD_FOR_UPDATE:
71 1
                return ['id'];
72 1
            case self::BUILD_FOR_PATCH:
73
            default:
74 1
                return [];
75
        }
76
    }
77
}
78