@@ -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 |
@@ -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()); |
@@ -48,7 +48,7 @@ |
||
48 | 48 | |
49 | 49 | $canInteractUser = $this->getInteractUser(); |
50 | 50 | $interaction = $this->interactionRepository->getByInteractUser($canInteractUser, $pageId); |
51 | - if(!isset($interaction)) { |
|
51 | + if (!isset($interaction)) { |
|
52 | 52 | $canInteractUser->addInteraction($interactions, $pageId, $doneValue); |
53 | 53 | return; |
54 | 54 | } |
@@ -11,7 +11,7 @@ |
||
11 | 11 | { |
12 | 12 | public function handle($request, Closure $next) |
13 | 13 | { |
14 | - if($request->input('wiki_session_id')){ |
|
14 | + if ($request->input('wiki_session_id')) { |
|
15 | 15 | Session::put('wiki_session_id', $request->input('wiki_session_id')); |
16 | 16 | } |
17 | 17 | return $next($request); |
@@ -8,7 +8,7 @@ |
||
8 | 8 | |
9 | 9 | interface AuthGateway |
10 | 10 | { |
11 | - public function current():? User; |
|
11 | + public function current(): ? User; |
|
12 | 12 | public function log(User $u); |
13 | - public function wikiSessionId():?string; |
|
13 | + public function wikiSessionId(): ?string; |
|
14 | 14 | } |
@@ -31,19 +31,19 @@ discard block |
||
31 | 31 | { |
32 | 32 | $email = $firstname = $lastname = ''; |
33 | 33 | |
34 | - if($request->session()->has('user_to_register')){ |
|
34 | + if ($request->session()->has('user_to_register')) { |
|
35 | 35 | $user = $request->session()->get('user_to_register'); |
36 | 36 | $email = $user['email']; |
37 | 37 | $firstname = $user['firstname']; |
38 | 38 | $lastname = $user['lastname']; |
39 | 39 | } |
40 | 40 | |
41 | - if($request->has('wiki_callback')){ |
|
41 | + if ($request->has('wiki_callback')) { |
|
42 | 42 | session()->flash('wiki_callback', $request->input('wiki_callback')); |
43 | 43 | session()->flash('wiki_token', $request->input('wiki_token')); |
44 | 44 | } |
45 | 45 | |
46 | - if(session()->has('should_attach_to_organization')) { |
|
46 | + if (session()->has('should_attach_to_organization')) { |
|
47 | 47 | session()->reflash(); |
48 | 48 | } |
49 | 49 | return view('public.auth.register', [ |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | protected function validator(array $data) |
57 | 57 | { |
58 | - if(session()->has('should_attach_to_organization')) { |
|
58 | + if (session()->has('should_attach_to_organization')) { |
|
59 | 59 | session()->reflash(); |
60 | 60 | } |
61 | 61 | return Validator::make($data, [ |
@@ -80,16 +80,16 @@ discard block |
||
80 | 80 | protected function registered(Request $request, $user) |
81 | 81 | { |
82 | 82 | $this->guard()->login($user, true); |
83 | - if($request->session()->has('should_attach_to_organization')){ |
|
83 | + if ($request->session()->has('should_attach_to_organization')) { |
|
84 | 84 | app(AttachUserToAnOrganization::class)->attach($user->uuid, $request->session()->get('should_attach_to_organization')); |
85 | 85 | } |
86 | 86 | $user = Auth::user(); |
87 | 87 | |
88 | - if($user->context_id === null) { |
|
88 | + if ($user->context_id === null) { |
|
89 | 89 | return redirect()->route('wizard.profile'); |
90 | 90 | } |
91 | 91 | |
92 | - if($request->session()->has('wiki_callback')){ |
|
92 | + if ($request->session()->has('wiki_callback')) { |
|
93 | 93 | $user->wiki_token = $request->session()->get('wiki_token'); |
94 | 94 | $user->save(); |
95 | 95 | $callback = urldecode($request->session()->get('wiki_callback')); |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | public function redirectToProvider(string $provider) |
103 | 103 | { |
104 | 104 | config(['services.'.$provider.'.redirect' => env(strtoupper($provider).'_CALLBACK')]); |
105 | - if($provider === 'twitter'){ |
|
105 | + if ($provider === 'twitter') { |
|
106 | 106 | return Socialite::driver($provider)->redirect(); |
107 | 107 | } |
108 | 108 | return Socialite::driver($provider)->redirectUrl(config('services.'.$provider.'.redirect'))->redirect(); |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | $user = User::where('uuid', $userId)->first(); |
116 | 116 | $this->guard()->login($user); |
117 | 117 | |
118 | - if($user->context_id !== null){ |
|
118 | + if ($user->context_id !== null) { |
|
119 | 119 | $user->wiki_token = $request->session()->get('wiki_token'); |
120 | 120 | $user->save(); |
121 | 121 | $callback = urldecode($request->session()->get('wiki_callback')); |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | } |
124 | 124 | |
125 | 125 | return redirect()->route('wizard.profile'); |
126 | - }catch (ValidationException $e) { |
|
126 | + } catch (ValidationException $e) { |
|
127 | 127 | $attributes = $e->validator->attributes(); |
128 | 128 | $attributes['provider'] = $provider; |
129 | 129 | return redirect()->route('register-social-network') |
@@ -19,7 +19,7 @@ |
||
19 | 19 | public function execute(int $pageId) |
20 | 20 | { |
21 | 21 | $page = $this->pageRepository->get($pageId); |
22 | - if($page === null){ |
|
22 | + if ($page === null) { |
|
23 | 23 | $page = new Page($pageId, true); |
24 | 24 | $this->pageRepository->save($page); |
25 | 25 | return; |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | public function current(): ?User |
15 | 15 | { |
16 | 16 | $userModel = Auth::user(); |
17 | - if(!isset($userModel)){ |
|
17 | + if (!isset($userModel)) { |
|
18 | 18 | return null; |
19 | 19 | } |
20 | 20 | $roles = $userModel->roles()->pluck('name')->toArray(); |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | Auth::login($authenticate, true); |
28 | 28 | } |
29 | 29 | |
30 | - public function wikiSessionId():? string |
|
30 | + public function wikiSessionId(): ? string |
|
31 | 31 | { |
32 | 32 | return Session::get('wiki_session_id'); |
33 | 33 | } |
@@ -61,14 +61,14 @@ discard block |
||
61 | 61 | return ucfirst($this->firstname).' '.ucfirst($this->lastname); |
62 | 62 | } |
63 | 63 | |
64 | - public function organizationId():?string |
|
64 | + public function organizationId(): ?string |
|
65 | 65 | { |
66 | 66 | return $this->organizationId; |
67 | 67 | } |
68 | 68 | |
69 | 69 | public function provider(string $provider, string $providerId):bool |
70 | 70 | { |
71 | - if(isset($this->providers[$provider]) && $this->providers[$provider] == $providerId){ |
|
71 | + if (isset($this->providers[$provider]) && $this->providers[$provider] == $providerId) { |
|
72 | 72 | return true; |
73 | 73 | } |
74 | 74 | return false; |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | |
88 | 88 | public function create(string $passwordHashed = null, Picture $picture = null) |
89 | 89 | { |
90 | - if(isset($picture)) { |
|
91 | - $picture->resize('app/public/users/' . $this->id); |
|
90 | + if (isset($picture)) { |
|
91 | + $picture->resize('app/public/users/'.$this->id); |
|
92 | 92 | $this->pathPicture = $picture->relativePath(); |
93 | 93 | } |
94 | 94 | app(UserRepository::class)->add($this, $passwordHashed); |
@@ -130,20 +130,20 @@ discard block |
||
130 | 130 | $this->email = $email; |
131 | 131 | $this->firstname = $firstname; |
132 | 132 | $this->lastname = $lastname; |
133 | - if($pathPicture !== "") { |
|
133 | + if ($pathPicture !== "") { |
|
134 | 134 | $picture = new Picture($pathPicture); |
135 | - $picture->resize('app/public/users/' . $this->id . '.' . $ext); |
|
136 | - $this->pathPicture = 'app/public/users/' . $this->id . '.' . $ext; |
|
135 | + $picture->resize('app/public/users/'.$this->id.'.'.$ext); |
|
136 | + $this->pathPicture = 'app/public/users/'.$this->id.'.'.$ext; |
|
137 | 137 | } |
138 | 138 | app(UserRepository::class)->update($this); |
139 | 139 | } |
140 | 140 | |
141 | 141 | public function updateAvatar(string $pathPicture, string $ext = 'jpg') |
142 | 142 | { |
143 | - if($pathPicture !== "") { |
|
143 | + if ($pathPicture !== "") { |
|
144 | 144 | $picture = new Picture($pathPicture); |
145 | - $picture->resize('app/public/users/' . $this->id . '.' . $ext); |
|
146 | - $this->pathPicture = 'app/public/users/' . $this->id . '.' . $ext; |
|
145 | + $picture->resize('app/public/users/'.$this->id.'.'.$ext); |
|
146 | + $this->pathPicture = 'app/public/users/'.$this->id.'.'.$ext; |
|
147 | 147 | } |
148 | 148 | app(UserRepository::class)->update($this); |
149 | 149 | return $this->pathPicture; |