UsersRequestBuilder   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
eloc 9
dl 0
loc 32
c 0
b 0
f 0
ccs 10
cts 10
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A addUsers() 0 3 1
A build() 0 5 1
A addUser() 0 3 1
1
<?php
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
namespace SchulIT\IdpExchange\Request\Builder;
4
5
use SchulIT\IdpExchange\Request\UsersRequest;
6
7
class UsersRequestBuilder {
0 ignored issues
show
Coding Style introduced by
Missing doc comment for class UsersRequestBuilder
Loading history...
Coding Style introduced by
Opening brace of a class must be on the line after the definition
Loading history...
8
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
9
     * @var string[]
10
     */
11
    private $usernames = [ ];
0 ignored issues
show
Coding Style introduced by
Private member variable "usernames" must be prefixed with an underscore
Loading history...
12
13
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
14
     * @param string $user
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...
15
     * @return UsersRequestBuilder
0 ignored issues
show
Coding Style introduced by
Tag @return cannot be grouped with parameter tags in a doc comment
Loading history...
16
     */
17 2
    public function addUser(string $user): UsersRequestBuilder {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on a new line
Loading history...
18 2
        $this->usernames[] = $user;
19 2
        return $this;
20
    }
21
22
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
23
     * @param string[] $users
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...
24
     * @return UsersRequestBuilder
0 ignored issues
show
Coding Style introduced by
Tag @return cannot be grouped with parameter tags in a doc comment
Loading history...
25
     */
26 1
    public function addUsers(array $users): UsersRequestBuilder {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on a new line
Loading history...
27 1
        $this->usernames = array_merge($this->usernames, $users);
28 1
        return $this;
29
    }
30
31
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
32
     * @return UsersRequest
33
     */
34 2
    public function build(): UsersRequest {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on a new line
Loading history...
35 2
        $request = new UsersRequest();
36 2
        $request->usernames = $this->usernames;
37
38 2
        return $request;
39
    }
40
}