Completed
Push — master ( 262f01...3234c0 )
by Marcel
04:02
created

UsersResponseBuilder::build()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 8
c 0
b 0
f 0
ccs 5
cts 5
cp 1
rs 10
cc 2
nc 2
nop 0
crap 2
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\UserResponse;
6
use SchulIT\IdpExchange\Response\UsersResponse;
7
8
class UsersResponseBuilder {
0 ignored issues
show
Coding Style introduced by
Missing doc comment for class UsersResponseBuilder
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 UserResponse[]
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 UserResponse $userResponse
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...
17
     * @return UsersResponseBuilder
0 ignored issues
show
Coding Style introduced by
Tag @return cannot be grouped with parameter tags in a doc comment
Loading history...
18
     */
19 1
    public function addUser(UserResponse $userResponse): UsersResponseBuilder {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on a new line
Loading history...
20 1
        $this->users[] = $userResponse;
21 1
        return $this;
22
    }
23
24
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
25
     * @return UsersResponse
26
     */
27 1
    public function build(): UsersResponse {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on a new line
Loading history...
28 1
        $response = new UsersResponse();
29
30 1
        foreach($this->users as $userResponse) {
0 ignored issues
show
Coding Style introduced by
Expected "foreach (...) {\n"; found "foreach(...) {\n"
Loading history...
31 1
            $response->users[] = clone $userResponse;
32
        }
33
34 1
        return $response;
35
    }
36
}