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.
Completed
Push — master ( 647968...9660af )
by Ema
02:11
created

UserBuilder   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 98
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 10
lcom 1
cbo 1
dl 0
loc 98
ccs 25
cts 25
cp 1
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A setEmail() 0 6 1
A setUsername() 0 6 1
A setPassword() 0 6 1
A setFirstName() 0 6 1
A setLastName() 0 6 1
A setNickname() 0 6 1
A getRequiredFields() 0 12 4
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
    /**
12
     * @param $email
13
     *
14
     * @return $this
15
     */
16 2
    public function setEmail($email)
17
    {
18 2
        $this->params['email'] = $email;
19
20 2
        return $this;
21
    }
22
23
    /**
24
     * @param $username
25
     *
26
     * @return $this
27
     */
28 2
    public function setUsername($username)
29
    {
30 2
        $this->params['username'] = $username;
31
32 2
        return $this;
33
    }
34
35
    /**
36
     * Set the user password.
37
     *
38
     * @param $password
39
     *
40
     * @return $this
41
     */
42 2
    public function setPassword($password)
43
    {
44 2
        $this->params['password'] = $password;
45
46 2
        return $this;
47
    }
48
49
    /**
50
     * Set the user first name.
51
     *
52
     * @param $firstName
53
     *
54
     * @return $this
55
     */
56 1
    public function setFirstName($firstName)
57
    {
58 1
        $this->params['first_name'] = $firstName;
59
60 1
        return $this;
61
    }
62
63
    /**
64
     * Set the user last name.
65
     *
66
     * @param $lastName
67
     *
68
     * @return $this
69
     */
70 1
    public function setLastName($lastName)
71
    {
72 1
        $this->params['last_name'] = $lastName;
73
74 1
        return $this;
75
    }
76
77
    /**
78
     * Set the user's nickname.
79
     *
80
     * @param $nickname
81
     *
82
     * @return $this
83
     */
84 1
    public function setNickname($nickname)
85
    {
86 1
        $this->params['nickname'] = $nickname;
87
88 1
        return $this;
89
    }
90
91
    /**
92
     * {@inheritdoc}
93
     */
94 5
    protected function getRequiredFields($buildType = self::BUILD_FOR_CREATE)
95
    {
96
        switch ($buildType) {
97 5
            case self::BUILD_FOR_CREATE:
98 3
                return ['username', 'email', 'password'];
99 2
            case self::BUILD_FOR_UPDATE:
100 1
                return ['id'];
101 1
            case self::BUILD_FOR_PATCH:
102
            default:
103 1
                return [];
104
        }
105
    }
106
}
107