SchulIT /
idp-exchange-models
| 1 | <?php |
||
| 2 | |||
|
0 ignored issues
–
show
Coding Style
introduced
by
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
|
|||
| 9 | |||
| 10 | /** |
||
|
0 ignored issues
–
show
|
|||
| 11 | * @var UserUpdateInformation[] |
||
| 12 | */ |
||
| 13 | private $users = [ ]; |
||
|
0 ignored issues
–
show
|
|||
| 14 | |||
| 15 | /** |
||
|
0 ignored issues
–
show
|
|||
| 16 | * @param string $username |
||
|
0 ignored issues
–
show
|
|||
| 17 | * @param \DateTime $updated |
||
|
0 ignored issues
–
show
|
|||
| 18 | * @return UpdatedUsersResponseBuilder |
||
|
0 ignored issues
–
show
|
|||
| 19 | */ |
||
| 20 | 1 | public function addUser(string $username, \DateTime $updated): UpdatedUsersResponseBuilder { |
|
|
0 ignored issues
–
show
|
|||
| 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
|
|||
| 30 | * @return UpdatedUsersResponse |
||
| 31 | */ |
||
| 32 | 1 | public function build(): UpdatedUsersResponse { |
|
|
0 ignored issues
–
show
|
|||
| 33 | 1 | $response = new UpdatedUsersResponse(); |
|
| 34 | 1 | $response->users = $this->users; |
|
| 35 | |||
| 36 | 1 | return $response; |
|
| 37 | } |
||
| 38 | } |