UpdatedUsersResponseBuilder   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 10
dl 0
loc 29
c 0
b 0
f 0
ccs 10
cts 10
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A build() 0 5 1
A addUser() 0 7 1
1
<?php
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
namespace SchulIT\IdpExchange\Response\Builder;
4
5
use SchulIT\IdpExchange\Response\UserUpdateInformation;
6
use SchulIT\IdpExchange\Response\UpdatedUsersResponse;
7
8
class UpdatedUsersResponseBuilder {
0 ignored issues
show
Coding Style introduced by
Missing doc comment for class UpdatedUsersResponseBuilder
Loading history...
Coding Style introduced by
Opening brace of a class must be on the line after the definition
Loading history...
9
10
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
11
     * @var UserUpdateInformation[]
12
     */
13
    private $users = [ ];
0 ignored issues
show
Coding Style introduced by
Private member variable "users" must be prefixed with an underscore
Loading history...
14
15
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
16
     * @param string $username
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 4 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Tag value for @param tag indented incorrectly; expected 2 spaces but found 1
Loading history...
17
     * @param \DateTime $updated
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Tag value for @param tag indented incorrectly; expected 2 spaces but found 1
Loading history...
18
     * @return UpdatedUsersResponseBuilder
0 ignored issues
show
Coding Style introduced by
Tag @return cannot be grouped with parameter tags in a doc comment
Loading history...
19
     */
20 1
    public function addUser(string $username, \DateTime $updated): UpdatedUsersResponseBuilder {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on a new line
Loading history...
21 1
        $user = new UserUpdateInformation();
22 1
        $user->username = $username;
23 1
        $user->updated = $updated;
24
25 1
        $this->users[] = $user;
26 1
        return $this;
27
    }
28
29
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
30
     * @return UpdatedUsersResponse
31
     */
32 1
    public function build(): UpdatedUsersResponse {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on a new line
Loading history...
33 1
        $response = new UpdatedUsersResponse();
34 1
        $response->users = $this->users;
35
36 1
        return $response;
37
    }
38
}