Completed
Pull Request — master (#77)
by guillaume
07:36
created
Src/UseCases/Domain/Agricultural/Queries/InteractionsQueryByPageAndUser.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
         $this->authGateway = $authGateway;
26 26
     }
27 27
 
28
-    public function execute(int $pageId):?Interaction
28
+    public function execute(int $pageId): ?Interaction
29 29
     {
30 30
         $canInteractUser = $this->getInteractUser();
31 31
         return $this->interactionRepository->getByInteractUser($canInteractUser, $pageId);
Please login to merge, or discard this patch.
app/Src/UseCases/Infra/Sql/PageRepositorySql.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
     public function get(string $pageId): ?Page
14 14
     {
15 15
         $pageModel = PageModel::where('page_id', $pageId)->first();
16
-        if(!isset($pageModel)){
16
+        if (!isset($pageModel)) {
17 17
             return null;
18 18
         }
19 19
         return new Page($pageModel->page_id, $pageModel->dry);
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
     public function save(Page $page)
23 23
     {
24 24
         $pageModel = PageModel::where('page_id', $page->pageId())->first();
25
-        if(!isset($pageModel)){
25
+        if (!isset($pageModel)) {
26 26
             $pageModel = new PageModel();
27 27
         }
28 28
         $pageModel->page_id = $page->pageId();
Please login to merge, or discard this patch.
app/Http/Middleware/SetWikiSessionId.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.
app/Src/UseCases/Domain/Shared/Gateway/AuthGateway.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
app/Console/Commands/SyncDryPagesFromWiki.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
     {
24 24
         $httpClient = new Client();
25 25
 
26
-        PageModel::query()->where('dry', true)->chunkById(50, function ($items, $count) use($httpClient){
26
+        PageModel::query()->where('dry', true)->chunkById(50, function($items, $count) use($httpClient){
27 27
             $this->info(($count*50).' Pages');
28 28
             $pages = $items->pluck('page_id')->toArray();
29 29
             $pagesApiUri = config('wiki.api_uri').$this->queryPages.implode('|', $pages);
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
             $content = json_decode($response->getBody()->getContents(), true);
32 32
             $wikiPages = $content['query']['pages'];
33 33
 
34
-            foreach($wikiPages as $page){
34
+            foreach ($wikiPages as $page) {
35 35
                 $pageModel = PageModel::query()->where('page_id', $page['pageid'])->first();
36 36
                 $pageModel->dry = false;
37 37
                 $pageModel->title = $page['title'];
Please login to merge, or discard this patch.
app/Http/Controllers/Auth/RegisterController.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -31,19 +31,19 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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')
Please login to merge, or discard this patch.
app/Src/UseCases/Domain/System/SetPageDryState.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
app/Src/UseCases/Infra/Gateway/SessionAuthGateway.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
app/Src/UseCases/Infra/Sql/InteractionPageRepositorySql.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
             ->where('page_id', $interaction->pageId())
25 25
             ->first();
26 26
 
27
-        if($interactionModel === null) {
27
+        if ($interactionModel === null) {
28 28
             $interactionModel = new InteractionModel();
29 29
             $interactionModel->{$canInteract->key()} = isset($user->id) ? $user->id : $canInteract->identifier();
30 30
         }
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
     public function getByInteractUser(CanInteract $canInteract, int $pageId): ?Interaction
38 38
     {
39
-        if($canInteract->key() == 'user_id') {
39
+        if ($canInteract->key() == 'user_id') {
40 40
             $user = User::query()->where('uuid', $canInteract->identifier())->first();
41 41
         }
42 42
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
             ->where('page_id', $pageId)
46 46
             ->first();
47 47
 
48
-        if(!isset($interactionModel)){
48
+        if (!isset($interactionModel)) {
49 49
             return null;
50 50
         }
51 51
 
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
             ->orderBy('updated_at', 'desc')
82 82
             ->get();
83 83
 
84
-        foreach($interactionsModel as $interaction) {
84
+        foreach ($interactionsModel as $interaction) {
85 85
             $page = PageModel::query()->where('page_id', $interaction->page_id)->first();
86 86
             $applause = InteractionModel::query()->where('page_id', $interaction->page_id)->where('applause', true)->count();
87 87
             if ($interaction->follow) {
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
             ->where('user_id', $user->id)
104 104
             ->where('done', true)
105 105
             ->get();
106
-        foreach ($records as $record){
106
+        foreach ($records as $record) {
107 107
             $practises[] = new PractiseVo(
108 108
                 $record->page_id,
109 109
                 $record->page->title ?? '',
Please login to merge, or discard this patch.