@@ -16,20 +16,20 @@ discard block |
||
| 16 | 16 | $this->users[] = $u; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | - public function getByEmail(string $email):?User |
|
| 19 | + public function getByEmail(string $email): ?User |
|
| 20 | 20 | { |
| 21 | - foreach ($this->users as $user){ |
|
| 22 | - if($user->email() === $email){ |
|
| 21 | + foreach ($this->users as $user) { |
|
| 22 | + if ($user->email() === $email) { |
|
| 23 | 23 | return $user; |
| 24 | 24 | } |
| 25 | 25 | } |
| 26 | 26 | return null; |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - public function getById(string $id):?User |
|
| 29 | + public function getById(string $id): ?User |
|
| 30 | 30 | { |
| 31 | - foreach ($this->users as $user){ |
|
| 32 | - if($user->id() === $id){ |
|
| 31 | + foreach ($this->users as $user) { |
|
| 32 | + if ($user->id() === $id) { |
|
| 33 | 33 | return $user; |
| 34 | 34 | } |
| 35 | 35 | } |
@@ -39,8 +39,8 @@ discard block |
||
| 39 | 39 | public function search(string $organizationId, int $page, int $perPage = 10): array |
| 40 | 40 | { |
| 41 | 41 | $users = []; |
| 42 | - foreach($this->users as $user){ |
|
| 43 | - if($user->organizationId() === $organizationId){ |
|
| 42 | + foreach ($this->users as $user) { |
|
| 43 | + if ($user->organizationId() === $organizationId) { |
|
| 44 | 44 | $users[] = $user; |
| 45 | 45 | } |
| 46 | 46 | } |
@@ -54,8 +54,8 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | public function update(User $u) |
| 56 | 56 | { |
| 57 | - foreach ($this->users as $key => $user){ |
|
| 58 | - if($user->id() === $u->id()){ |
|
| 57 | + foreach ($this->users as $key => $user) { |
|
| 58 | + if ($user->id() === $u->id()) { |
|
| 59 | 59 | $this->users[$key] = $u; |
| 60 | 60 | } |
| 61 | 61 | } |
@@ -63,8 +63,8 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | public function delete(string $userId) |
| 65 | 65 | { |
| 66 | - foreach ($this->users as $key => $user){ |
|
| 67 | - if($user->id() === $userId){ |
|
| 66 | + foreach ($this->users as $key => $user) { |
|
| 67 | + if ($user->id() === $userId) { |
|
| 68 | 68 | unset($this->users[$key]); |
| 69 | 69 | } |
| 70 | 70 | } |
@@ -73,8 +73,8 @@ discard block |
||
| 73 | 73 | public function getAdminOfOrganization(string $organizationId): array |
| 74 | 74 | { |
| 75 | 75 | $users = []; |
| 76 | - foreach ($this->users as $key => $user){ |
|
| 77 | - if($user->organizationId() === $organizationId && $user->isAdmin()){ |
|
| 76 | + foreach ($this->users as $key => $user) { |
|
| 77 | + if ($user->organizationId() === $organizationId && $user->isAdmin()) { |
|
| 78 | 78 | $users[] = $user; |
| 79 | 79 | } |
| 80 | 80 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | return ucfirst($this->firstname).' '.ucfirst($this->lastname); |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - public function organizationId():?string |
|
| 48 | + public function organizationId(): ?string |
|
| 49 | 49 | { |
| 50 | 50 | return $this->organizationId; |
| 51 | 51 | } |
@@ -89,10 +89,10 @@ discard block |
||
| 89 | 89 | $this->email = $email; |
| 90 | 90 | $this->firstname = $firstname; |
| 91 | 91 | $this->lastname = $lastname; |
| 92 | - if($pathPicture !== "") { |
|
| 92 | + if ($pathPicture !== "") { |
|
| 93 | 93 | $picture = new Picture($pathPicture); |
| 94 | - $picture->resize('app/public/users/' . $this->id . '.' . $ext); |
|
| 95 | - $this->pathPicture = 'app/public/users/' . $this->id . '.' . $ext; |
|
| 94 | + $picture->resize('app/public/users/'.$this->id.'.'.$ext); |
|
| 95 | + $this->pathPicture = 'app/public/users/'.$this->id.'.'.$ext; |
|
| 96 | 96 | } |
| 97 | 97 | app(UserRepository::class)->update($this); |
| 98 | 98 | } |