@@ -21,7 +21,7 @@ |
||
| 21 | 21 | public function edit(string $organizationId, string $name, array $picture, array $address) |
| 22 | 22 | { |
| 23 | 23 | $organization = $this->organizationRepository->get($organizationId); |
| 24 | - if(!isset($organization)){ |
|
| 24 | + if (!isset($organization)) { |
|
| 25 | 25 | throw new OrganizationNotFound(); |
| 26 | 26 | } |
| 27 | 27 | $this->validateData($name, $picture, $address); |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | public function grant(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 | |
@@ -57,14 +57,14 @@ discard block |
||
| 57 | 57 | return ucfirst($this->firstname).' '.ucfirst($this->lastname); |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - public function organizationId():?string |
|
| 60 | + public function organizationId(): ?string |
|
| 61 | 61 | { |
| 62 | 62 | return $this->organizationId; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | public function provider(string $provider, string $providerId):bool |
| 66 | 66 | { |
| 67 | - if(isset($this->providers[$provider]) && $this->providers[$provider] == $providerId){ |
|
| 67 | + if (isset($this->providers[$provider]) && $this->providers[$provider] == $providerId) { |
|
| 68 | 68 | return true; |
| 69 | 69 | } |
| 70 | 70 | return false; |
@@ -77,8 +77,8 @@ discard block |
||
| 77 | 77 | |
| 78 | 78 | public function create(string $passwordHashed = null, Picture $picture = null) |
| 79 | 79 | { |
| 80 | - if(isset($picture)) { |
|
| 81 | - $picture->resize('app/public/users/' . $this->id); |
|
| 80 | + if (isset($picture)) { |
|
| 81 | + $picture->resize('app/public/users/'.$this->id); |
|
| 82 | 82 | $this->pathPicture = $picture->relativePath(); |
| 83 | 83 | } |
| 84 | 84 | app(UserRepository::class)->add($this, $passwordHashed); |
@@ -120,10 +120,10 @@ discard block |
||
| 120 | 120 | $this->email = $email; |
| 121 | 121 | $this->firstname = $firstname; |
| 122 | 122 | $this->lastname = $lastname; |
| 123 | - if($pathPicture !== "") { |
|
| 123 | + if ($pathPicture !== "") { |
|
| 124 | 124 | $picture = new Picture($pathPicture); |
| 125 | - $picture->resize('app/public/users/' . $this->id . '.' . $ext); |
|
| 126 | - $this->pathPicture = 'app/public/users/' . $this->id . '.' . $ext; |
|
| 125 | + $picture->resize('app/public/users/'.$this->id.'.'.$ext); |
|
| 126 | + $this->pathPicture = 'app/public/users/'.$this->id.'.'.$ext; |
|
| 127 | 127 | } |
| 128 | 128 | app(UserRepository::class)->update($this); |
| 129 | 129 | } |
@@ -8,9 +8,9 @@ |
||
| 8 | 8 | |
| 9 | 9 | interface UserRepository |
| 10 | 10 | { |
| 11 | - public function getByEmail(string $email):? User; |
|
| 12 | - public function getById(string $id):?User; |
|
| 13 | - public function getByProvider(string $provider, string $providerId):?User; |
|
| 11 | + public function getByEmail(string $email): ? User; |
|
| 12 | + public function getById(string $id): ?User; |
|
| 13 | + public function getByProvider(string $provider, string $providerId): ?User; |
|
| 14 | 14 | public function search(string $organizationId, int $page, int $perPage = 10): array; |
| 15 | 15 | public function add(User $u, string $password = null); |
| 16 | 16 | public function update(User $u); |
@@ -89,7 +89,7 @@ |
||
| 89 | 89 | */ |
| 90 | 90 | private function checkProviderAllowed(?string $provider, ?string $providerId): void |
| 91 | 91 | { |
| 92 | - if($provider === null || $providerId === null){ |
|
| 92 | + if ($provider === null || $providerId === null) { |
|
| 93 | 93 | throw new ProviderMissing(); |
| 94 | 94 | } |
| 95 | 95 | if (!in_array($provider, $this->allowedProviders)) { |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | $user = $this->userRepository->getByEmail($email); |
| 22 | 22 | if (isset($user)) { |
| 23 | 23 | $errors['email'] = __('validation.unique', ['attribute' => 'email']); |
| 24 | - $validator->after(function () use ($validator, $errors) { |
|
| 24 | + $validator->after(function() use ($validator, $errors) { |
|
| 25 | 25 | foreach ($errors as $field => $error) { |
| 26 | 26 | $validator->errors()->add($field, $error); |
| 27 | 27 | } |
@@ -22,17 +22,17 @@ |
||
| 22 | 22 | { |
| 23 | 23 | $relativePath = $newPath; |
| 24 | 24 | $finalNewPath = storage_path().'/'.$newPath; |
| 25 | - if(isset($this->ext)){ |
|
| 25 | + if (isset($this->ext)) { |
|
| 26 | 26 | $finalNewPath = storage_path().'/'.$newPath.'.'.$this->ext; |
| 27 | 27 | $relativePath = $newPath.'.'.$this->ext; |
| 28 | 28 | } |
| 29 | - if(app(PictureHandler::class)->width($this->path) > 600) { |
|
| 29 | + if (app(PictureHandler::class)->width($this->path) > 600) { |
|
| 30 | 30 | app(PictureHandler::class)->widen($this->path, $finalNewPath, 600); |
| 31 | 31 | $this->relativePath = $relativePath; |
| 32 | 32 | return; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - if(app(PictureHandler::class)->height($this->path) > 400) { |
|
| 35 | + if (app(PictureHandler::class)->height($this->path) > 400) { |
|
| 36 | 36 | app(PictureHandler::class)->heighten($this->path, $finalNewPath, 400); |
| 37 | 37 | $this->relativePath = $relativePath; |
| 38 | 38 | return; |
@@ -101,7 +101,7 @@ |
||
| 101 | 101 | return $request->wantsJson() |
| 102 | 102 | ? new Response('', 201) |
| 103 | 103 | : redirect($this->redirectPath()); |
| 104 | - }catch (ValidationException $e) { |
|
| 104 | + } catch (ValidationException $e) { |
|
| 105 | 105 | $attributes = $e->validator->attributes(); |
| 106 | 106 | $attributes['provider'] = $provider; |
| 107 | 107 | return redirect()->route('register-social-network') |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | { |
| 33 | 33 | $email = $firstname = $lastname = ''; |
| 34 | 34 | |
| 35 | - if($request->session()->has('user_to_register')){ |
|
| 35 | + if ($request->session()->has('user_to_register')) { |
|
| 36 | 36 | $user = $request->session()->get('user_to_register'); |
| 37 | 37 | $email = $user['email']; |
| 38 | 38 | $firstname = $user['firstname']; |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | protected function validator(array $data) |
| 50 | 50 | { |
| 51 | - if(session()->has('should_attach_to_organization')) { |
|
| 51 | + if (session()->has('should_attach_to_organization')) { |
|
| 52 | 52 | session()->reflash(); |
| 53 | 53 | } |
| 54 | 54 | return Validator::make($data, [ |
@@ -69,11 +69,11 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | protected function registered(Request $request, $user) |
| 71 | 71 | { |
| 72 | - if($request->session()->has('should_attach_to_organization')){ |
|
| 72 | + if ($request->session()->has('should_attach_to_organization')) { |
|
| 73 | 73 | app(AttachUserToAnOrganization::class)->attach($user->uuid, $request->session()->get('should_attach_to_organization')); |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - if($request->session()->has('wiki_callback')){ |
|
| 76 | + if ($request->session()->has('wiki_callback')) { |
|
| 77 | 77 | $user = Auth::user(); |
| 78 | 78 | $user->wiki_token = $request->session()->get('wiki_token'); |
| 79 | 79 | $user->save(); |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | public function redirectToProvider(string $provider) |
| 86 | 86 | { |
| 87 | 87 | config(['services.'.$provider.'.redirect' => env(strtoupper($provider).'_CALLBACK')]); |
| 88 | - if($provider === 'twitter'){ |
|
| 88 | + if ($provider === 'twitter') { |
|
| 89 | 89 | return Socialite::driver($provider)->redirect(); |
| 90 | 90 | } |
| 91 | 91 | return Socialite::driver($provider)->redirectUrl(config('services.'.$provider.'.redirect'))->redirect(); |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | $user = User::where('uuid', $userId)->first(); |
| 99 | 99 | $this->guard()->login($user); |
| 100 | 100 | |
| 101 | - if($request->session()->has('wiki_callback')){ |
|
| 101 | + if ($request->session()->has('wiki_callback')) { |
|
| 102 | 102 | $user = Auth::user(); |
| 103 | 103 | $user->wiki_token = $request->session()->get('wiki_token'); |
| 104 | 104 | $user->save(); |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | return $request->wantsJson() |
| 110 | 110 | ? new Response('', 201) |
| 111 | 111 | : redirect($this->redirectPath()); |
| 112 | - }catch (ValidationException $e) { |
|
| 112 | + } catch (ValidationException $e) { |
|
| 113 | 113 | $attributes = $e->validator->attributes(); |
| 114 | 114 | $attributes['provider'] = $provider; |
| 115 | 115 | return redirect()->route('register-social-network') |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | ->select() |
| 30 | 30 | ->where('hash', $hash) |
| 31 | 31 | ->first(); |
| 32 | - if(!isset($record)){ |
|
| 32 | + if (!isset($record)) { |
|
| 33 | 33 | return null; |
| 34 | 34 | } |
| 35 | 35 | return new Invitation($record->organization_id, $record->email, $record->firstname, $record->lastname); |