@@ -26,12 +26,12 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | public function listUsers(string $organizationId, Request $request, ListUsers $listUsers) |
| 28 | 28 | { |
| 29 | - $page = $request->input('start')/10 + 1; |
|
| 29 | + $page = $request->input('start')/10+1; |
|
| 30 | 30 | |
| 31 | 31 | $users = $listUsers->list($organizationId, $page, 10); |
| 32 | 32 | $total = init($users['total'], 0); |
| 33 | 33 | $list = []; |
| 34 | - foreach ($users['list'] as $user){ |
|
| 34 | + foreach ($users['list'] as $user) { |
|
| 35 | 35 | $user = $user->toArray(); |
| 36 | 36 | $list[] = [ |
| 37 | 37 | '', |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | public function editShowForm(string $userId, GetUser $getUser, GetOrganization $getOrganization, GetUserStats $getUserStats) |
| 52 | 52 | { |
| 53 | 53 | $user = $getUser->get($userId); |
| 54 | - if($user->organizationId() !== null) { |
|
| 54 | + if ($user->organizationId() !== null) { |
|
| 55 | 55 | $organization = $getOrganization->get($user->organizationId()); |
| 56 | 56 | } |
| 57 | 57 | $stats = $getUserStats->get($userId); |
@@ -88,11 +88,11 @@ discard block |
||
| 88 | 88 | public function delete(string $userId, Request $request, DeleteUser $deleteUser) |
| 89 | 89 | { |
| 90 | 90 | $redirect = 'back'; |
| 91 | - if($userId === Auth::id()){ |
|
| 91 | + if ($userId === Auth::id()) { |
|
| 92 | 92 | $redirect = 'login'; |
| 93 | 93 | } |
| 94 | 94 | $deleteUser->delete($userId); |
| 95 | - if($redirect === 'login') { |
|
| 95 | + if ($redirect === 'login') { |
|
| 96 | 96 | return redirect()->route('login'); |
| 97 | 97 | } |
| 98 | 98 | $request->session()->flash('notif_msg', __('users.message.user.deleted')); |
@@ -36,31 +36,31 @@ |
||
| 36 | 36 | { |
| 37 | 37 | $this->registerHelpers(); |
| 38 | 38 | |
| 39 | - if(config('app.env') === 'testing'){ |
|
| 39 | + if (config('app.env') === 'testing') { |
|
| 40 | 40 | $this->tuBinding(); |
| 41 | 41 | } |
| 42 | - if(config('app.env') === 'testing-ti'){ |
|
| 42 | + if (config('app.env') === 'testing-ti') { |
|
| 43 | 43 | $this->tiBinding(); |
| 44 | 44 | } |
| 45 | - if(config('app.env') === 'local' || config('app.env') === 'production'){ |
|
| 45 | + if (config('app.env') === 'local' || config('app.env') === 'production') { |
|
| 46 | 46 | $this->prodBinding(); |
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | public function boot() |
| 51 | 51 | { |
| 52 | - if(config('app.env') !== 'testing' && config('app.env') !== 'testing-ti') { |
|
| 52 | + if (config('app.env') !== 'testing' && config('app.env') !== 'testing-ti') { |
|
| 53 | 53 | Schema::defaultStringLength(191); |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - if(config('app.env') === 'local' || config('app.env') === 'production'){ |
|
| 56 | + if (config('app.env') === 'local' || config('app.env') === 'production') { |
|
| 57 | 57 | URL::forceScheme('https'); |
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | private function registerHelpers(): void |
| 62 | 62 | { |
| 63 | - foreach (glob(app_path() . '/Src/Utils/Helpers/*.php') as $filename) { |
|
| 63 | + foreach (glob(app_path().'/Src/Utils/Helpers/*.php') as $filename) { |
|
| 64 | 64 | require_once($filename); |
| 65 | 65 | } |
| 66 | 66 | } |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | return $this->providerId; |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - public function email():? string |
|
| 30 | + public function email(): ? string |
|
| 31 | 31 | { |
| 32 | 32 | return $this->email; |
| 33 | 33 | } |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | // need to show to the user. Finally, we'll send out a proper response. |
| 39 | 39 | $response = $this->broker()->sendResetLink( |
| 40 | 40 | $this->credentials($request), |
| 41 | - function ($user, $token){ |
|
| 41 | + function($user, $token) { |
|
| 42 | 42 | Mail::to($user->email) |
| 43 | 43 | ->send(new PasswordResetLink($user, $token)); |
| 44 | 44 | } |
@@ -7,7 +7,7 @@ |
||
| 7 | 7 | { |
| 8 | 8 | public function get() |
| 9 | 9 | { |
| 10 | - return collect([ |
|
| 10 | + return collect([ |
|
| 11 | 11 | new WikiUserRole('advisor'), |
| 12 | 12 | new WikiUserRole('farmer'), |
| 13 | 13 | new WikiUserRole('student'), |
@@ -106,7 +106,7 @@ |
||
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | return redirect()->route('wizard.profile'); |
| 109 | - }catch (ValidationException $e) { |
|
| 109 | + } catch (ValidationException $e) { |
|
| 110 | 110 | $attributes = $e->validator->attributes(); |
| 111 | 111 | $attributes['provider'] = $provider; |
| 112 | 112 | return redirect()->route('register-social-network') |
@@ -30,14 +30,14 @@ discard block |
||
| 30 | 30 | { |
| 31 | 31 | $email = $firstname = $lastname = ''; |
| 32 | 32 | |
| 33 | - if($request->session()->has('user_to_register')){ |
|
| 33 | + if ($request->session()->has('user_to_register')) { |
|
| 34 | 34 | $user = $request->session()->get('user_to_register'); |
| 35 | 35 | $email = $user['email']; |
| 36 | 36 | $firstname = $user['firstname']; |
| 37 | 37 | $lastname = $user['lastname']; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - if($request->has('wiki_callback')){ |
|
| 40 | + if ($request->has('wiki_callback')) { |
|
| 41 | 41 | session()->flash('wiki_callback', $request->input('wiki_callback')); |
| 42 | 42 | session()->flash('wiki_token', $request->input('wiki_token')); |
| 43 | 43 | } |
@@ -85,8 +85,8 @@ discard block |
||
| 85 | 85 | |
| 86 | 86 | $user = Auth::user(); |
| 87 | 87 | |
| 88 | - if($user->context_id === null) { |
|
| 89 | - if($request->session()->has('wiki_token')) { |
|
| 88 | + if ($user->context_id === null) { |
|
| 89 | + if ($request->session()->has('wiki_token')) { |
|
| 90 | 90 | $user->wiki_token = $request->session()->get('wiki_token'); |
| 91 | 91 | $user->save(); |
| 92 | 92 | } |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | /** |
| 98 | 98 | * should be deleted dead code ? |
| 99 | 99 | */ |
| 100 | - if($request->session()->has('wiki_callback')){ |
|
| 100 | + if ($request->session()->has('wiki_callback')) { |
|
| 101 | 101 | $user->wiki_token = $request->session()->get('wiki_token'); |
| 102 | 102 | $user->save(); |
| 103 | 103 | $callback = urldecode($request->session()->get('wiki_callback')); |
@@ -109,11 +109,11 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | public function redirectToProvider(string $provider) |
| 111 | 111 | { |
| 112 | - if(request()->session()->has('wiki_token')) { |
|
| 112 | + if (request()->session()->has('wiki_token')) { |
|
| 113 | 113 | session()->reflash(); |
| 114 | 114 | } |
| 115 | 115 | config(['services.'.$provider.'.redirect' => env(strtoupper($provider).'_CALLBACK')]); |
| 116 | - if($provider === 'twitter'){ |
|
| 116 | + if ($provider === 'twitter') { |
|
| 117 | 117 | return Socialite::driver($provider)->redirect(); |
| 118 | 118 | } |
| 119 | 119 | return Socialite::driver($provider)->redirectUrl(config('services.'.$provider.'.redirect'))->redirect(); |
@@ -130,14 +130,14 @@ discard block |
||
| 130 | 130 | $user->save(); |
| 131 | 131 | $this->guard()->login($user); |
| 132 | 132 | |
| 133 | - if($user->context_id !== null){ |
|
| 133 | + if ($user->context_id !== null) { |
|
| 134 | 134 | $user->wiki_token = $request->session()->get('wiki_token'); |
| 135 | 135 | $user->save(); |
| 136 | 136 | $callback = urldecode($request->session()->get('wiki_callback')); |
| 137 | 137 | return redirect($callback); |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | - if(session()->has('sso')){ |
|
| 140 | + if (session()->has('sso')) { |
|
| 141 | 141 | $sso = session()->get('sso'); |
| 142 | 142 | $sig = session()->get('sig'); |
| 143 | 143 | $wikiCode = session()->get('wikiCode'); |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | return redirect()->route('wizard.profile'); |
| 149 | - }catch (ValidationException $e) { |
|
| 149 | + } catch (ValidationException $e) { |
|
| 150 | 150 | $attributes = $e->validator->attributes(); |
| 151 | 151 | $attributes['provider'] = $provider; |
| 152 | 152 | return redirect()->route('register-social-network') |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | public function register(string $provider, SocialiteUser $socialiteUser) |
| 30 | 30 | { |
| 31 | 31 | $user = $this->userRepository->getByProvider($provider, $socialiteUser->providerId()); |
| 32 | - if(isset($user)){ |
|
| 32 | + if (isset($user)) { |
|
| 33 | 33 | return [ |
| 34 | 34 | 'user_id' => $user->id(), |
| 35 | 35 | 'provider_id' => $socialiteUser->providerId(), |
@@ -37,10 +37,10 @@ discard block |
||
| 37 | 37 | ]; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - if($socialiteUser->email() !== null && $socialiteUser->email() != "") { |
|
| 40 | + if ($socialiteUser->email() !== null && $socialiteUser->email() != "") { |
|
| 41 | 41 | $user = $this->userRepository->getByEmail($socialiteUser->email()); |
| 42 | 42 | } |
| 43 | - if(isset($user)){ |
|
| 43 | + if (isset($user)) { |
|
| 44 | 44 | $user->addProvider($provider, $socialiteUser->providerId()); |
| 45 | 45 | return [ |
| 46 | 46 | 'user_id' => $user->id(), |
@@ -89,8 +89,9 @@ |
||
| 89 | 89 | |
| 90 | 90 | // If the user has an email, we take it for granted that Google or Facebook has already verified it: |
| 91 | 91 | $email = $socialiteUser->email(); |
| 92 | - if (!empty($email)) |
|
| 93 | - $this->userRepository->verifyEmail($id); |
|
| 92 | + if (!empty($email)) { |
|
| 93 | + $this->userRepository->verifyEmail($id); |
|
| 94 | + } |
|
| 94 | 95 | |
| 95 | 96 | return [ |
| 96 | 97 | 'user_id' => $id, |
@@ -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; |
@@ -23,10 +23,10 @@ |
||
| 23 | 23 | $this->authGateway = $authGateway; |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - public function execute():?string |
|
| 26 | + public function execute(): ?string |
|
| 27 | 27 | { |
| 28 | 28 | $currentUser = $this->authGateway->current(); |
| 29 | - if(!isset($currentUser)){ |
|
| 29 | + if (!isset($currentUser)) { |
|
| 30 | 30 | return 'nothing_to_do'; |
| 31 | 31 | } |
| 32 | 32 | $anonymousUser = new AnonymousUser($this->authGateway->wikiSessionId()); |