Issues (181)

Response/Builder/UserResponseBuilder.php (30 issues)

1
<?php
2
0 ignored issues
show
Missing file doc comment
Loading history...
3
namespace SchulIT\IdpExchange\Response\Builder;
4
5
use SchulIT\IdpExchange\Response\AbstractAttribute;
6
use SchulIT\IdpExchange\Response\UserResponse;
7
use SchulIT\IdpExchange\Response\ValueAttribute;
8
use SchulIT\IdpExchange\Response\ValuesAttribute;
9
10
class UserResponseBuilder {
0 ignored issues
show
Missing doc comment for class UserResponseBuilder
Loading history...
Opening brace of a class must be on the line after the definition
Loading history...
11
12
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
13
     * @var string
14
     */
15
    private $username;
0 ignored issues
show
Private member variable "username" must be prefixed with an underscore
Loading history...
16
17
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
18
     * @var AbstractAttribute
19
     */
20
    private $attributes = [ ];
0 ignored issues
show
Private member variable "attributes" must be prefixed with an underscore
Loading history...
21
22
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
23
     * @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...
24
     * @return UserResponseBuilder
0 ignored issues
show
Tag @return cannot be grouped with parameter tags in a doc comment
Loading history...
25
     */
26 2
    public function setUsername(string $username): UserResponseBuilder {
0 ignored issues
show
Opening brace should be on a new line
Loading history...
27 2
        $this->username = $username;
28 2
        return $this;
29
    }
30
31
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
32
     * @param string $name
0 ignored issues
show
Missing parameter comment
Loading history...
Expected 6 spaces after parameter type; 1 found
Loading history...
Tag value for @param tag indented incorrectly; expected 2 spaces but found 1
Loading history...
33
     * @param string|null $value
0 ignored issues
show
Missing parameter comment
Loading history...
Tag value for @param tag indented incorrectly; expected 2 spaces but found 1
Loading history...
34
     * @return UserResponseBuilder
0 ignored issues
show
Tag @return cannot be grouped with parameter tags in a doc comment
Loading history...
35
     */
36 2
    public function addValueAttribute(string $name, ?string $value): UserResponseBuilder {
0 ignored issues
show
Opening brace should be on a new line
Loading history...
37 2
        $attribute = new ValueAttribute();
38 2
        $attribute->name = $name;
39 2
        $attribute->value = $value;
40
41 2
        $this->attributes[] = $attribute;
42 2
        return $this;
43
    }
44
45
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
46
     * @param string $name
0 ignored issues
show
Missing parameter comment
Loading history...
Tag value for @param tag indented incorrectly; expected 2 spaces but found 1
Loading history...
47
     * @param array $values
0 ignored issues
show
Missing parameter comment
Loading history...
Expected 2 spaces after parameter type; 1 found
Loading history...
Tag value for @param tag indented incorrectly; expected 2 spaces but found 1
Loading history...
48
     * @return UserResponseBuilder
0 ignored issues
show
Tag @return cannot be grouped with parameter tags in a doc comment
Loading history...
49
     */
50 1
    public function addValuesAttribute(string $name, array $values): UserResponseBuilder {
0 ignored issues
show
Opening brace should be on a new line
Loading history...
51 1
        $attribute = new ValuesAttribute();
52 1
        $attribute->name = $name;
53 1
        $attribute->values = $values;
54
55 1
        $this->attributes[] = $attribute;
56 1
        return $this;
57
    }
58
59
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
60
     * @return UserResponse
61
     */
62 5
    public function build(): UserResponse {
0 ignored issues
show
Opening brace should be on a new line
Loading history...
63 5
        $userResponse = new UserResponse();
64 5
        $userResponse->username = $this->username;
65 5
        $userResponse->attributes = $this->attributes;
66
67 5
        return $userResponse;
68
    }
69
}