Test Setup Failed
Pull Request — master (#26)
by guillaume
05:24
created
app/Http/Controllers/Api/OAuthController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,12 +14,12 @@
 block discarded – undo
14 14
     {
15 15
         $token = $request->input('wiki_token', null);
16 16
 
17
-        if($token === null || $token === ''){
17
+        if ($token === null || $token === '') {
18 18
             return ['error' => 'invalid_token'];
19 19
         }
20 20
         $user = User::where('wiki_token', $token)->first();
21 21
 
22
-        if($user === null){
22
+        if ($user === null) {
23 23
             return ['error' => 'invalid_token'];
24 24
         }
25 25
 
Please login to merge, or discard this patch.
app/Console/Commands/ImportUsersStatsFromWiki.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,11 +28,11 @@  discard block
 block discarded – undo
28 28
 
29 29
         $this->dbWiki->table('user')
30 30
             ->orderBy('user.user_id', 'desc')
31
-            ->chunk(200, function ($records){
31
+            ->chunk(200, function($records) {
32 32
                 foreach ($records as $record) {
33 33
 
34 34
                     $user = $this->userRepository->getByEmail($record->user_email);
35
-                    if(!isset($user)){
35
+                    if (!isset($user)) {
36 36
                         continue;
37 37
                     }
38 38
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
                     $editsOnWiki = $this->getEditsOnWikiNumber($record->user_id);
43 43
 
44 44
 
45
-                    $numberContributions = $questions + $answers + $votes + $editsOnWiki;
45
+                    $numberContributions = $questions+$answers+$votes+$editsOnWiki;
46 46
                     $fields = [
47 47
                         'number_contributions' => $numberContributions,
48 48
                         'number_questions' => $questions,
Please login to merge, or discard this patch.
app/Http/Controllers/Auth/LoginController.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
     public function showLoginForm(Request $request)
26 26
     {
27 27
         session()->reflash();
28
-        if($request->has('wiki_callback')){
28
+        if ($request->has('wiki_callback')) {
29 29
             session()->flash('wiki_callback', $request->input('wiki_callback'));
30 30
             session()->flash('wiki_token', $request->input('wiki_token'));
31 31
         }
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 
35 35
     public function logout(Request $request)
36 36
     {
37
-        if($request->session()->has('should_attach_to_organization')) {
37
+        if ($request->session()->has('should_attach_to_organization')) {
38 38
             $shouldAttach = $request->session()->get('should_attach_to_organization');
39 39
             $shouldAttachToken = $request->session()->get('should_attach_to_organization_token');
40 40
             $linkToRedirect = $request->session()->get('should_attach_to_organization_redirect');
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 
47 47
         $request->session()->regenerateToken();
48 48
 
49
-        if(isset($shouldAttach)){
49
+        if (isset($shouldAttach)) {
50 50
             $request->session()->flash('should_attach_to_organization', $shouldAttach);
51 51
             $request->session()->flash('should_attach_to_organization_token', $shouldAttachToken);
52 52
             $request->session()->flash('should_attach_to_organization_redirect', $linkToRedirect);
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
     protected function loggedOut(Request $request)
65 65
     {
66 66
         $request->session()->reflash();
67
-        if($request->session()->has('should_attach_to_organization')){
67
+        if ($request->session()->has('should_attach_to_organization')) {
68 68
             $linkToRedirect = $request->session()->get('should_attach_to_organization_redirect');
69 69
             return $request->wantsJson()
70 70
                 ? new Response('', 204)
@@ -74,14 +74,14 @@  discard block
 block discarded – undo
74 74
 
75 75
     protected function authenticated(Request $request, $user)
76 76
     {
77
-        if($request->session()->has('wiki_callback')){
77
+        if ($request->session()->has('wiki_callback')) {
78 78
             $user = Auth::user();
79 79
             $user->wiki_token = $request->session()->get('wiki_token');
80 80
             $user->save();
81 81
             $callback = urldecode($request->session()->get('wiki_callback'));
82 82
             return redirect($callback);
83 83
         }
84
-        if($request->session()->has('should_attach_to_organization') && $request->session()->get('should_attach_to_organization') !== null){
84
+        if ($request->session()->has('should_attach_to_organization') && $request->session()->get('should_attach_to_organization') !== null) {
85 85
             $token = $request->session()->get('should_attach_to_organization_token');
86 86
             $link = route('organization.invite.show').'?&token='.$token;
87 87
             return $request->wantsJson()
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 
93 93
     public function redirectToProvider(string $provider)
94 94
     {
95
-        if(session()->has('wiki_callback')){
95
+        if (session()->has('wiki_callback')) {
96 96
             session()->reflash();
97 97
         }
98 98
         config(['services.'.$provider.'.redirect' => env(strtoupper($provider).'_CALLBACK_LOGIN')]);
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
     {
104 104
         config(['services.'.$provider.'.redirect' => env(strtoupper($provider).'_CALLBACK_LOGIN')]);
105 105
         $logUserFromSocialNetwork->log($provider);
106
-        if(session()->has('wiki_callback')){
106
+        if (session()->has('wiki_callback')) {
107 107
             return $this->authenticated(request(), null);
108 108
         }
109 109
         return redirect()->route('home');
Please login to merge, or discard this patch.
app/Http/Middleware/RedirectIfAuthenticated.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
      */
19 19
     public function handle($request, Closure $next, $guard = null)
20 20
     {
21
-        if($request->has('wiki_callback') && Auth::user() !== null){
21
+        if ($request->has('wiki_callback') && Auth::user() !== null) {
22 22
             return $this->redirectToWiki($request);
23 23
         }
24 24
 
Please login to merge, or discard this patch.
app/Http/Controllers/UsersController.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -25,12 +25,12 @@  discard block
 block discarded – undo
25 25
 
26 26
     public function listUsers(string $organizationId, Request $request, ListUsers $listUsers)
27 27
     {
28
-        $page = $request->input('start')/10 + 1;
28
+        $page = $request->input('start')/10+1;
29 29
 
30 30
         $users = $listUsers->list($organizationId, $page, 10);
31 31
         $total = isset($users['total']) ? $users['total'] : 0;
32 32
         $list = [];
33
-        foreach ($users['list'] as $user){
33
+        foreach ($users['list'] as $user) {
34 34
             $user = $user->toArray();
35 35
             $list[] = [
36 36
                 '',
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     public function editShowForm(string $userId, GetUser $getUser, GetOrganization $getOrganization, GetUserStats $getUserStats)
56 56
     {
57 57
         $user = $getUser->get($userId);
58
-        if($user->organizationId() !== null) {
58
+        if ($user->organizationId() !== null) {
59 59
             $organization = $getOrganization->get($user->organizationId());
60 60
         }
61 61
         $stats = $getUserStats->get($userId);
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
         $lastname = $request->input('lastname') !== null ? $request->input('lastname') : '';
74 74
         $email = $request->input('email') !== null ? $request->input('email') : '';
75 75
         $picture = [];
76
-        if($request->has('logo')){
76
+        if ($request->has('logo')) {
77 77
             $picture['path_picture'] = $request->file('logo')->path();
78 78
             $picture['original_name'] = $request->file('logo')->getClientOriginalName();
79 79
             $picture['mine_type'] = $request->file('logo')->getMimeType();
@@ -100,11 +100,11 @@  discard block
 block discarded – undo
100 100
     public function delete(string $userId, Request $request, DeleteUser $deleteUser)
101 101
     {
102 102
         $redirect = 'back';
103
-        if($userId === Auth::id()){
103
+        if ($userId === Auth::id()) {
104 104
             $redirect = 'login';
105 105
         }
106 106
         $deleteUser->delete($userId);
107
-        if($redirect === 'login') {
107
+        if ($redirect === 'login') {
108 108
             return redirect()->route('login');
109 109
         }
110 110
         $request->session()->flash('notif_msg', __('users.message.user.deleted'));
Please login to merge, or discard this patch.
app/Providers/AppServiceProvider.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,11 +32,11 @@  discard block
 block discarded – undo
32 32
 {
33 33
     public function register()
34 34
     {
35
-        foreach (glob(app_path().'/Src/Utils/Helpers/*.php') as $filename){
35
+        foreach (glob(app_path().'/Src/Utils/Helpers/*.php') as $filename) {
36 36
             require_once($filename);
37 37
         }
38 38
 
39
-        if(config('app.env') === 'testing'){
39
+        if (config('app.env') === 'testing') {
40 40
             $this->app->singleton(OrganizationRepository::class, InMemoryOrganizationRepository::class);
41 41
             $this->app->singleton(PictureHandler::class, InMemoryPictureHandler::class);
42 42
             $this->app->singleton(UserRepository::class, InMemoryUserRepository::class);
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
             $this->app->singleton(HashGen::class, InMemoryHashGen::class);
47 47
             $this->app->singleton(InvitationRepository::class, InMemoryInvitationRepository::class);
48 48
         }
49
-        if(config('app.env') === 'testing-ti'){
49
+        if (config('app.env') === 'testing-ti') {
50 50
             $this->app->singleton(OrganizationRepository::class, SqlOrganizationRepository::class);
51 51
             $this->app->singleton(InvitationRepository::class, InMemoryInvitationRepository::class);
52 52
             $this->app->singleton(PictureHandler::class, InMemoryPictureHandler::class);
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
             $this->app->singleton(SocialiteGateway::class, InMemorySocialiteGateway::class);
58 58
         }
59 59
 
60
-        if(config('app.env') === 'local' || config('app.env') === 'production'){
60
+        if (config('app.env') === 'local' || config('app.env') === 'production') {
61 61
             $this->app->singleton(OrganizationRepository::class, SqlOrganizationRepository::class);
62 62
             $this->app->singleton(InvitationRepository::class, InvitationRepositorySql::class);
63 63
             $this->app->singleton(PictureHandler::class, StoragePictureHandler::class);
Please login to merge, or discard this patch.
app/Http/Controllers/OrganizationsController.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -51,11 +51,11 @@  discard block
 block discarded – undo
51 51
 
52 52
     public function listOrganizations(Request $request, ListOrganizations $listOrganizations)
53 53
     {
54
-        $page = $request->input('start')/10 + 1;
54
+        $page = $request->input('start')/10+1;
55 55
         $organizations = $listOrganizations->list($page, 10);
56 56
         $total = isset($organizations['total']) ? $organizations['total'] : 0;
57 57
         $list = [];
58
-        foreach ($organizations['list'] as $organization){
58
+        foreach ($organizations['list'] as $organization) {
59 59
             $org = $organization->toArray();
60 60
             $list[] = [
61 61
                 $org['name'],
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         return format($total, $list);
70 70
     }
71 71
 
72
-    public function prepareInvitation(Request $request,  PrepareInvitationUsersInOrganization $prepareInvitationUsersInOrganization)
72
+    public function prepareInvitation(Request $request, PrepareInvitationUsersInOrganization $prepareInvitationUsersInOrganization)
73 73
     {
74 74
         $users = $request->input('users');
75 75
         $users = explode(PHP_EOL, $users);
@@ -96,19 +96,19 @@  discard block
 block discarded – undo
96 96
     public function acceptInvite(Request $request, RespondInvitationToAnOrganization $respondInvitationToAnOrganization)
97 97
     {
98 98
         $action = $respondInvitationToAnOrganization->respond($token = $request->input('token'));
99
-        if($action['action'] == 'register'){
99
+        if ($action['action'] == 'register') {
100 100
             $request->session()->flash('should_attach_to_organization', $action['organization_id']);
101 101
             $request->session()->flash('user_to_register', $action['user']);
102 102
             return redirect()->route('register');
103 103
         }
104
-        if($action['action'] == 'accept_or_decline'){
104
+        if ($action['action'] == 'accept_or_decline') {
105 105
             $request->session()->flash('should_attach_to_organization', $action['organization_to_join']->id());
106 106
             return view('organizations.accept-or-decline-invitation', [
107 107
                 'old_organisation' => isset($action['old_organisation']) ? $action['old_organisation']->toArray() : null,
108 108
                 'organization_to_join' => isset($action['organization_to_join']) ? $action['organization_to_join']->toArray() : null
109 109
             ]);
110 110
         }
111
-        if($action['action'] == 'logout-login'){
111
+        if ($action['action'] == 'logout-login') {
112 112
             $request->session()->flash('should_attach_to_organization', $action['organization_to_join']->id());
113 113
             $request->session()->flash('should_attach_to_organization_token', $token);
114 114
             $request->session()->flash('should_attach_to_organization_redirect', route('login'));
@@ -117,14 +117,14 @@  discard block
 block discarded – undo
117 117
             ]);
118 118
         }
119 119
 
120
-        if($action['action'] == 'login'){
120
+        if ($action['action'] == 'login') {
121 121
             $request->session()->flash('should_attach_to_organization', $action['organization_to_join']->id());
122 122
             $request->session()->flash('should_attach_to_organization_token', $token);
123 123
             $request->session()->flash('should_attach_to_organization_redirect', route('login'));
124 124
             return redirect()->route('login');
125 125
         }
126 126
 
127
-        if($action['action'] == 'logout-register'){
127
+        if ($action['action'] == 'logout-register') {
128 128
             $request->session()->flash('should_attach_to_organization', $action['organization_to_join']->id());
129 129
             $request->session()->flash('should_attach_to_organization_token', $token);
130 130
             $request->session()->flash('should_attach_to_organization_redirect', route('register'));
Please login to merge, or discard this patch.