@@ -20,7 +20,7 @@ |
||
| 20 | 20 | public function invite(string $organizationId, array $users) |
| 21 | 21 | { |
| 22 | 22 | $organization = $this->organizationRepository->get($organizationId); |
| 23 | - foreach($users as $user){ |
|
| 23 | + foreach ($users as $user) { |
|
| 24 | 24 | $email = $user['email']; |
| 25 | 25 | $firstname = isset($user['firstname']) ? $user['firstname'] : ''; |
| 26 | 26 | $lastname = isset($user['lastname']) ? $user['lastname'] : ''; |
@@ -33,10 +33,10 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | public function create(string $ext = 'jpg') |
| 35 | 35 | { |
| 36 | - if($this->pathPicture !== "") { |
|
| 36 | + if ($this->pathPicture !== "") { |
|
| 37 | 37 | $picture = new Picture($this->pathPicture); |
| 38 | - $picture->resize('app/public/organizations/' . $this->id . '.' . $ext); |
|
| 39 | - $this->pathPicture = 'app/public/organizations/' . $this->id . '.' . $ext; |
|
| 38 | + $picture->resize('app/public/organizations/'.$this->id.'.'.$ext); |
|
| 39 | + $this->pathPicture = 'app/public/organizations/'.$this->id.'.'.$ext; |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | app(OrganizationRepository::class)->add($this); |
@@ -46,11 +46,11 @@ discard block |
||
| 46 | 46 | { |
| 47 | 47 | $this->name = $name; |
| 48 | 48 | $this->address = $address; |
| 49 | - if($picture['path'] !== "") { |
|
| 49 | + if ($picture['path'] !== "") { |
|
| 50 | 50 | $logo = new Picture($picture['path']); |
| 51 | 51 | $ext = $picture['ext']; |
| 52 | - $logo->resize('app/public/organizations/' . $this->id . '.' . $ext); |
|
| 53 | - $this->pathPicture = 'app/public/organizations/' . $this->id . '.' . $ext; |
|
| 52 | + $logo->resize('app/public/organizations/'.$this->id.'.'.$ext); |
|
| 53 | + $this->pathPicture = 'app/public/organizations/'.$this->id.'.'.$ext; |
|
| 54 | 54 | } |
| 55 | 55 | app(OrganizationRepository::class)->update($this); |
| 56 | 56 | } |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | |
| 9 | 9 | interface OrganizationRepository |
| 10 | 10 | { |
| 11 | - public function get(string $id):? Organization; |
|
| 11 | + public function get(string $id): ? Organization; |
|
| 12 | 12 | public function add(Organization $o); |
| 13 | 13 | public function update(Organization $o); |
| 14 | 14 | public function search(int $page, int $perPage = 10): array; |
@@ -8,8 +8,8 @@ |
||
| 8 | 8 | |
| 9 | 9 | interface UserRepository |
| 10 | 10 | { |
| 11 | - public function getByEmail(string $email):? User; |
|
| 12 | - public function getById(string $id):?User; |
|
| 11 | + public function getByEmail(string $email): ? User; |
|
| 12 | + public function getById(string $id): ?User; |
|
| 13 | 13 | public function search(string $organizationId, int $page, int $perPage = 10): array; |
| 14 | 14 | public function add(User $u, string $password = null); |
| 15 | 15 | public function update(User $u); |
@@ -17,12 +17,12 @@ |
||
| 17 | 17 | |
| 18 | 18 | public function resize(string $newPath) |
| 19 | 19 | { |
| 20 | - if(app(PictureHandler::class)->width($this->path) > 600) { |
|
| 20 | + if (app(PictureHandler::class)->width($this->path) > 600) { |
|
| 21 | 21 | app(PictureHandler::class)->widen($this->path, storage_path().'/'.$newPath, 600); |
| 22 | 22 | return; |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - if(app(PictureHandler::class)->height($this->path) > 400) { |
|
| 25 | + if (app(PictureHandler::class)->height($this->path) > 400) { |
|
| 26 | 26 | app(PictureHandler::class)->heighten($this->path, storage_path().'/'.$newPath, 400); |
| 27 | 27 | return; |
| 28 | 28 | } |
@@ -33,11 +33,11 @@ discard block |
||
| 33 | 33 | $organizationToJoin = $this->organizationRepository->get($organizationId); |
| 34 | 34 | |
| 35 | 35 | $currentUser = $this->authGateway->current(); |
| 36 | - if(isset($currentUser) && $currentUser->email() !== $email){ |
|
| 36 | + if (isset($currentUser) && $currentUser->email() !== $email) { |
|
| 37 | 37 | $action = 'logout'; |
| 38 | 38 | $action .= !isset($user) ? '-register' : '-login'; |
| 39 | 39 | |
| 40 | - if($action == 'logout-login') { |
|
| 40 | + if ($action == 'logout-login') { |
|
| 41 | 41 | return [ |
| 42 | 42 | 'action' => $action, |
| 43 | 43 | 'organization_to_join' => $organizationToJoin, |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | |
| 59 | - if(!isset($user)){ |
|
| 59 | + if (!isset($user)) { |
|
| 60 | 60 | return [ |
| 61 | 61 | 'action' => 'register', |
| 62 | 62 | 'organization_id' => $organizationId, |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | $currentUser = $this->authGateway->current(); |
| 72 | - if(!isset($currentUser)){ |
|
| 72 | + if (!isset($currentUser)) { |
|
| 73 | 73 | return [ |
| 74 | 74 | 'action' => 'login', |
| 75 | 75 | 'organization_to_join' => $organizationToJoin, |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | $organization = null; |
| 80 | - if($user->organizationId() !== null) { |
|
| 80 | + if ($user->organizationId() !== null) { |
|
| 81 | 81 | $organization = $this->organizationRepository->get($user->organizationId()); |
| 82 | 82 | } |
| 83 | 83 | |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | public function get(string $userId):User |
| 21 | 21 | { |
| 22 | 22 | $user = $this->userRepository->getById($userId); |
| 23 | - if(!isset($user)){ |
|
| 23 | + if (!isset($user)) { |
|
| 24 | 24 | throw new UserNotFound(); |
| 25 | 25 | } |
| 26 | 26 | return $user; |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | public function edit(string $userId, string $email, string $firstname, string $lastname, array $picture) |
| 21 | 21 | { |
| 22 | 22 | $user = $this->userRepository->getById($userId); |
| 23 | - if(!isset($user)){ |
|
| 23 | + if (!isset($user)) { |
|
| 24 | 24 | throw new UserNotFound(); |
| 25 | 25 | } |
| 26 | 26 | $this->validateData($userId, $firstname, $lastname, $email, $picture); |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | if (isset($user) && $user->id() !== $userId) { |
| 54 | 54 | $errors['email'] = __('validation.unique', ['attribute' => 'email']); |
| 55 | 55 | } |
| 56 | - $validator->after(function () use ($validator, $errors) { |
|
| 56 | + $validator->after(function() use ($validator, $errors) { |
|
| 57 | 57 | foreach ($errors as $field => $error) { |
| 58 | 58 | $validator->errors()->add($field, $error); |
| 59 | 59 | } |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | public function revoke(string $userId, string $organizationId) |
| 20 | 20 | { |
| 21 | 21 | $user = $this->userRepository->getById($userId); |
| 22 | - if(!$user->belongsTo($organizationId)){ |
|
| 22 | + if (!$user->belongsTo($organizationId)) { |
|
| 23 | 23 | throw new UserGrantAdminException(); |
| 24 | 24 | } |
| 25 | 25 | |