@@ -23,9 +23,9 @@ discard block |
||
23 | 23 | $usersLoop = $this->getUsersToProcess($users, $usersLoop, $filePathUsers); |
24 | 24 | $errors = $imported = 0; |
25 | 25 | |
26 | - foreach($usersLoop as $userToInvite){ |
|
26 | + foreach ($usersLoop as $userToInvite) { |
|
27 | 27 | $validator = $this->validateUserData($userToInvite); |
28 | - if($validator->fails()){ |
|
28 | + if ($validator->fails()) { |
|
29 | 29 | $userToInvite['error'] = 'email.error.syntax'; |
30 | 30 | $usersToProcess['users'][] = $userToInvite; |
31 | 31 | $errors++; |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | list($userToInvite, $errors) = $this->checkIfUserAlreadyIn($organizationId, $userToInvite, $errors); |
36 | 36 | |
37 | 37 | $usersToProcess['users'][] = $userToInvite; |
38 | - if(!isset($userToInvite["error"])){ |
|
38 | + if (!isset($userToInvite["error"])) { |
|
39 | 39 | $imported++; |
40 | 40 | } |
41 | 41 | } |
@@ -39,23 +39,23 @@ |
||
39 | 39 | $organizationToJoin = $this->organizationRepository->get($organizationId); |
40 | 40 | |
41 | 41 | $currentUser = $this->authGateway->current(); |
42 | - if(isset($currentUser) && $currentUser->email() !== $email){ |
|
42 | + if (isset($currentUser) && $currentUser->email() !== $email) { |
|
43 | 43 | $action = 'logout'; |
44 | 44 | $action .= !isset($user) ? '-register' : '-login'; |
45 | 45 | |
46 | - if($action == 'logout-login') { |
|
46 | + if ($action == 'logout-login') { |
|
47 | 47 | return $this->badUserLoginToAcceptAction($action, $organizationToJoin); |
48 | 48 | } |
49 | 49 | return $this->returnLogoutAction($action, $organizationToJoin, $email, $firstname, $lastname); |
50 | 50 | } |
51 | 51 | |
52 | 52 | |
53 | - if(!isset($user)){ |
|
53 | + if (!isset($user)) { |
|
54 | 54 | return $this->returnRegisterAction($organizationId, $email, $firstname, $lastname); |
55 | 55 | } |
56 | 56 | |
57 | 57 | $currentUser = $this->authGateway->current(); |
58 | - if(!isset($currentUser)){ |
|
58 | + if (!isset($currentUser)) { |
|
59 | 59 | return $this->returnLoginAction($organizationToJoin); |
60 | 60 | } |
61 | 61 |
@@ -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')); |
@@ -12,15 +12,15 @@ |
||
12 | 12 | { |
13 | 13 | public function user(string $provider): SocialiteUser |
14 | 14 | { |
15 | - if($provider === 'twitter'){ |
|
15 | + if ($provider === 'twitter') { |
|
16 | 16 | $user = Socialite::driver($provider)->user(); |
17 | - }else { |
|
17 | + } else { |
|
18 | 18 | $user = Socialite::driver($provider)->stateless()->user(); |
19 | 19 | } |
20 | 20 | |
21 | 21 | $email = $user->getEmail(); |
22 | 22 | $firstname = $user->getNickname() !== null ? $user->getNickname() : $user->getName(); |
23 | - if(isset($user->user['given_name'])){ |
|
23 | + if (isset($user->user['given_name'])) { |
|
24 | 24 | $firstname = $user->user['given_name']; |
25 | 25 | } |
26 | 26 | $lastname = isset($user->user['family_name']) ? $user->user['family_name'] : $user->getName(); |
@@ -14,7 +14,7 @@ |
||
14 | 14 | { |
15 | 15 | if($provider === 'twitter'){ |
16 | 16 | $user = Socialite::driver($provider)->user(); |
17 | - }else { |
|
17 | + } else { |
|
18 | 18 | $user = Socialite::driver($provider)->stateless()->user(); |
19 | 19 | } |
20 | 20 |
@@ -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 | } |
@@ -9,14 +9,14 @@ |
||
9 | 9 | public function handle($request, Closure $next, $guard = null) |
10 | 10 | { |
11 | 11 | $params = $request->all(); |
12 | - if(isset($params['\code'])) { |
|
12 | + if (isset($params['\code'])) { |
|
13 | 13 | $request->merge([ |
14 | 14 | '\code' => null, |
15 | 15 | 'code' => $params['\code'] |
16 | 16 | ]); |
17 | 17 | } |
18 | 18 | |
19 | - if(isset($params['\oauth_token'])) { |
|
19 | + if (isset($params['\oauth_token'])) { |
|
20 | 20 | $request->merge([ |
21 | 21 | '\oauth_token' => null, |
22 | 22 | 'oauth_token' => $params['\oauth_token'] |
@@ -18,20 +18,20 @@ discard block |
||
18 | 18 | $this->users[] = $u; |
19 | 19 | } |
20 | 20 | |
21 | - public function getByEmail(string $email):?User |
|
21 | + public function getByEmail(string $email): ?User |
|
22 | 22 | { |
23 | - foreach ($this->users as $user){ |
|
24 | - if($user->email() === $email){ |
|
23 | + foreach ($this->users as $user) { |
|
24 | + if ($user->email() === $email) { |
|
25 | 25 | return $user; |
26 | 26 | } |
27 | 27 | } |
28 | 28 | return null; |
29 | 29 | } |
30 | 30 | |
31 | - public function getById(string $id):?User |
|
31 | + public function getById(string $id): ?User |
|
32 | 32 | { |
33 | - foreach ($this->users as $user){ |
|
34 | - if($user->id() === $id){ |
|
33 | + foreach ($this->users as $user) { |
|
34 | + if ($user->id() === $id) { |
|
35 | 35 | return $user; |
36 | 36 | } |
37 | 37 | } |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | public function search(string $organizationId, int $page, int $perPage = 10): array |
42 | 42 | { |
43 | 43 | $users = []; |
44 | - foreach($this->users as $user){ |
|
45 | - if($user->organizationId() === $organizationId){ |
|
44 | + foreach ($this->users as $user) { |
|
45 | + if ($user->organizationId() === $organizationId) { |
|
46 | 46 | $users[] = $user->toDto(); |
47 | 47 | } |
48 | 48 | } |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | |
57 | 57 | public function update(User $u) |
58 | 58 | { |
59 | - foreach ($this->users as $key => $user){ |
|
60 | - if($user->id() === $u->id()){ |
|
59 | + foreach ($this->users as $key => $user) { |
|
60 | + if ($user->id() === $u->id()) { |
|
61 | 61 | $this->users[$key] = $u; |
62 | 62 | } |
63 | 63 | } |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | |
66 | 66 | public function updateProviders(User $u) |
67 | 67 | { |
68 | - foreach ($this->users as $key => $user){ |
|
69 | - if($user->id() === $u->id()){ |
|
68 | + foreach ($this->users as $key => $user) { |
|
69 | + if ($user->id() === $u->id()) { |
|
70 | 70 | $this->users[$key] = $u; |
71 | 71 | } |
72 | 72 | } |
@@ -74,8 +74,8 @@ discard block |
||
74 | 74 | |
75 | 75 | public function delete(string $userId) |
76 | 76 | { |
77 | - foreach ($this->users as $key => $user){ |
|
78 | - if($user->id() === $userId){ |
|
77 | + foreach ($this->users as $key => $user) { |
|
78 | + if ($user->id() === $userId) { |
|
79 | 79 | unset($this->users[$key]); |
80 | 80 | } |
81 | 81 | } |
@@ -84,8 +84,8 @@ discard block |
||
84 | 84 | public function getAdminOfOrganization(string $organizationId): array |
85 | 85 | { |
86 | 86 | $users = []; |
87 | - foreach ($this->users as $key => $user){ |
|
88 | - if($user->organizationId() === $organizationId && $user->isAdmin()){ |
|
87 | + foreach ($this->users as $key => $user) { |
|
88 | + if ($user->organizationId() === $organizationId && $user->isAdmin()) { |
|
89 | 89 | $users[] = $user; |
90 | 90 | } |
91 | 91 | } |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | |
95 | 95 | public function getByProvider(string $provider, string $providerId): ?User |
96 | 96 | { |
97 | - foreach ($this->users as $user){ |
|
98 | - if($user->provider($provider, $providerId) === true){ |
|
97 | + foreach ($this->users as $user) { |
|
98 | + if ($user->provider($provider, $providerId) === true) { |
|
99 | 99 | return $user; |
100 | 100 | } |
101 | 101 | } |
@@ -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 | } |
@@ -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) { |
|
40 | + if ($socialiteUser->email() !== null) { |
|
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(), |