Issues (181)

Request/Builder/UpdatedUsersRequestBuilder.php (25 issues)

1
<?php
2
0 ignored issues
show
Missing file doc comment
Loading history...
3
namespace SchulIT\IdpExchange\Request\Builder;
4
5
use SchulIT\IdpExchange\Request\UpdatedUsersRequest;
6
7
class UpdatedUsersRequestBuilder {
0 ignored issues
show
Missing doc comment for class UpdatedUsersRequestBuilder
Loading history...
Opening brace of a class must be on the line after the definition
Loading history...
8
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
9
     * @var string[]
10
     */
11
    private $usernames = [ ];
0 ignored issues
show
Private member variable "usernames" must be prefixed with an underscore
Loading history...
12
13
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
14
     * @var \DateTime
15
     */
16
    private $since = null;
0 ignored issues
show
Private member variable "since" must be prefixed with an underscore
Loading history...
17
18
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
19
     * @param string $username
0 ignored issues
show
Missing parameter comment
Loading history...
Tag value for @param tag indented incorrectly; expected 2 spaces but found 1
Loading history...
20
     * @return $this
0 ignored issues
show
Tag @return cannot be grouped with parameter tags in a doc comment
Loading history...
21
     */
22 1
    public function addUser(string $username): UpdatedUsersRequestBuilder {
0 ignored issues
show
Opening brace should be on a new line
Loading history...
23 1
        $this->usernames[] = $username;
24 1
        return $this;
25
    }
26
27
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
28
     * @param string[] $users
0 ignored issues
show
Missing parameter comment
Loading history...
Tag value for @param tag indented incorrectly; expected 2 spaces but found 1
Loading history...
29
     * @return UpdatedUsersRequestBuilder
0 ignored issues
show
Tag @return cannot be grouped with parameter tags in a doc comment
Loading history...
30
     */
31 2
    public function addUsers(array $users): UpdatedUsersRequestBuilder {
0 ignored issues
show
Opening brace should be on a new line
Loading history...
32 2
        $this->usernames = array_merge($this->usernames, $users);
33 2
        return $this;
34
    }
35
36
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
37
     * @param \DateTime $dateTime
0 ignored issues
show
Missing parameter comment
Loading history...
Tag value for @param tag indented incorrectly; expected 2 spaces but found 1
Loading history...
38
     * @return UpdatedUsersRequestBuilder
0 ignored issues
show
Tag @return cannot be grouped with parameter tags in a doc comment
Loading history...
39
     */
40
    public function since(\DateTime $dateTime): UpdatedUsersRequestBuilder {
0 ignored issues
show
Opening brace should be on a new line
Loading history...
41
        $this->since = $dateTime;
42
        return $this;
43
    }
44
45
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
46
     * @return UpdatedUsersRequest
47
     */
48 3
    public function build(): UpdatedUsersRequest {
0 ignored issues
show
Opening brace should be on a new line
Loading history...
49 3
        $request = new UpdatedUsersRequest();
50 3
        $request->usernames = $this->usernames;
51 3
        if($this->since !== null) {
0 ignored issues
show
Expected "if (...) {\n"; found "if(...) {\n"
Loading history...
52
            $request->since = clone $this->since;
53
        }
54
55 3
        return $request;
56
    }
57
}