Test Setup Failed
Pull Request — master (#23)
by guillaume
18:46
created
app/Src/UseCases/Domain/Picture.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,17 +22,17 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
app/Http/Controllers/Auth/RegisterController.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  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'];
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 
48 48
     protected function validator(array $data)
49 49
     {
50
-        if(session()->has('should_attach_to_organization')) {
50
+        if (session()->has('should_attach_to_organization')) {
51 51
             session()->reflash();
52 52
         }
53 53
         return Validator::make($data, [
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
      */
82 82
     protected function registered(Request $request, $user)
83 83
     {
84
-        if($request->session()->has('should_attach_to_organization')){
84
+        if ($request->session()->has('should_attach_to_organization')) {
85 85
             app(AttachUserToAnOrganization::class)->attach($user->uuid, $request->session()->get('should_attach_to_organization'));
86 86
         }
87 87
     }
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
             return $request->wantsJson()
102 102
                 ? new Response('', 201)
103 103
                 : redirect($this->redirectPath());
104
-        }catch (ValidationException $e) {
104
+        } catch (ValidationException $e) {
105 105
             $attributes = $e->validator->attributes();
106 106
             $attributes['provider'] = $provider;
107 107
             return redirect()->route('register-social-network')
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@
 block discarded – undo
101 101
             return $request->wantsJson()
102 102
                 ? new Response('', 201)
103 103
                 : redirect($this->redirectPath());
104
-        }catch (ValidationException $e) {
104
+        } catch (ValidationException $e) {
105 105
             $attributes = $e->validator->attributes();
106 106
             $attributes['provider'] = $provider;
107 107
             return redirect()->route('register-social-network')
Please login to merge, or discard this patch.
app/Src/UseCases/Infra/Sql/InvitationRepositorySql.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
             ->select()
30 30
             ->where('hash', $hash)
31 31
             ->first();
32
-        if(!isset($record)){
32
+        if (!isset($record)) {
33 33
             return null;
34 34
         }
35 35
         return new Invitation($record->organization_id, $record->email, $record->firstname, $record->lastname);
Please login to merge, or discard this patch.
app/Src/UseCases/Infra/InMemory/InMemoryInvitationRepository.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,10 +16,10 @@
 block discarded – undo
16 16
         $this->invitations[] = $i;
17 17
     }
18 18
 
19
-    public function getByHash(string $hash):?Invitation
19
+    public function getByHash(string $hash): ?Invitation
20 20
     {
21
-        foreach ($this->invitations as $invitation){
22
-            if($invitation->hash() === $hash){
21
+        foreach ($this->invitations as $invitation) {
22
+            if ($invitation->hash() === $hash) {
23 23
                 return $invitation;
24 24
             }
25 25
         }
Please login to merge, or discard this patch.
app/Src/UseCases/Infra/InMemory/InMemoryUserRepository.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -16,20 +16,20 @@  discard block
 block discarded – undo
16 16
         $this->users[] = $u;
17 17
     }
18 18
 
19
-    public function getByEmail(string $email):?User
19
+    public function getByEmail(string $email): ?User
20 20
     {
21
-        foreach ($this->users as $user){
22
-            if($user->email() === $email){
21
+        foreach ($this->users as $user) {
22
+            if ($user->email() === $email) {
23 23
                 return $user;
24 24
             }
25 25
         }
26 26
         return null;
27 27
     }
28 28
 
29
-    public function getById(string $id):?User
29
+    public function getById(string $id): ?User
30 30
     {
31
-        foreach ($this->users as $user){
32
-            if($user->id() === $id){
31
+        foreach ($this->users as $user) {
32
+            if ($user->id() === $id) {
33 33
                 return $user;
34 34
             }
35 35
         }
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
     public function search(string $organizationId, int $page, int $perPage = 10): array
40 40
     {
41 41
         $users = [];
42
-        foreach($this->users as $user){
43
-            if($user->organizationId() === $organizationId){
42
+        foreach ($this->users as $user) {
43
+            if ($user->organizationId() === $organizationId) {
44 44
                 $users[] = $user->toDto();
45 45
             }
46 46
         }
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
 
55 55
     public function update(User $u)
56 56
     {
57
-        foreach ($this->users as $key => $user){
58
-            if($user->id() === $u->id()){
57
+        foreach ($this->users as $key => $user) {
58
+            if ($user->id() === $u->id()) {
59 59
                 $this->users[$key] = $u;
60 60
             }
61 61
         }
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
 
64 64
     public function delete(string $userId)
65 65
     {
66
-        foreach ($this->users as $key => $user){
67
-            if($user->id() === $userId){
66
+        foreach ($this->users as $key => $user) {
67
+            if ($user->id() === $userId) {
68 68
                 unset($this->users[$key]);
69 69
             }
70 70
         }
@@ -73,8 +73,8 @@  discard block
 block discarded – undo
73 73
     public function getAdminOfOrganization(string $organizationId): array
74 74
     {
75 75
         $users = [];
76
-        foreach ($this->users as $key => $user){
77
-            if($user->organizationId() === $organizationId && $user->isAdmin()){
76
+        foreach ($this->users as $key => $user) {
77
+            if ($user->organizationId() === $organizationId && $user->isAdmin()) {
78 78
                 $users[] = $user;
79 79
             }
80 80
         }
@@ -83,8 +83,8 @@  discard block
 block discarded – undo
83 83
 
84 84
     public function getByProvider(string $provider, string $providerId): ?User
85 85
     {
86
-        foreach ($this->users as $user){
87
-            if($user->provider($provider, $providerId) === true){
86
+        foreach ($this->users as $user) {
87
+            if ($user->provider($provider, $providerId) === true) {
88 88
                 return $user;
89 89
             }
90 90
         }
Please login to merge, or discard this patch.
app/Src/UseCases/Domain/Ports/InvitationRepository.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,5 +9,5 @@
 block discarded – undo
9 9
 interface InvitationRepository
10 10
 {
11 11
     public function add(Invitation $i);
12
-    public function getByHash(string $hash):?Invitation;
12
+    public function getByHash(string $hash): ?Invitation;
13 13
 }
Please login to merge, or discard this patch.
app/Src/UseCases/Domain/InviteUsersInOrganization.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
     {
30 30
         $invitations = [];
31 31
         $organization = $this->organizationRepository->get($organizationId);
32
-        foreach($users as $user){
32
+        foreach ($users as $user) {
33 33
             $email = $user['email'];
34 34
             $firstname = isset($user['firstname']) ? $user['firstname'] : '';
35 35
             $lastname = isset($user['lastname']) ? $user['lastname'] : '';
Please login to merge, or discard this patch.
app/User.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
     public function adminlte_image()
30 30
     {
31 31
         $urlPicture = $this->path_picture != "" ? asset('storage/'.str_replace('app/public/', '', $this->path_picture)) : null;
32
-        if(!isset($urlPicture) || $urlPicture === ""){
32
+        if (!isset($urlPicture) || $urlPicture === "") {
33 33
             $urlPicture = url('').'/'.config('adminlte.logo_img');
34 34
         }
35 35
         return $urlPicture;
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
     public function adminlte_desc()
39 39
     {
40 40
         $desc = ucfirst($this->firstname).' '.ucfirst($this->lastname);
41
-        if($this->organization_id !== null){
41
+        if ($this->organization_id !== null) {
42 42
             $organization = app(OrganizationRepository::class)->get($this->organization_id);
43 43
             $desc .= ' - organisme : '.$organization->name();
44 44
         }
Please login to merge, or discard this patch.
app/Providers/AppServiceProvider.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 {
33 33
     public function register()
34 34
     {
35
-        if(config('app.env') === 'testing'){
35
+        if (config('app.env') === 'testing') {
36 36
             $this->app->singleton(OrganizationRepository::class, InMemoryOrganizationRepository::class);
37 37
             $this->app->singleton(PictureHandler::class, InMemoryPictureHandler::class);
38 38
             $this->app->singleton(UserRepository::class, InMemoryUserRepository::class);
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
             $this->app->singleton(HashGen::class, InMemoryHashGen::class);
43 43
             $this->app->singleton(InvitationRepository::class, InMemoryInvitationRepository::class);
44 44
         }
45
-        if(config('app.env') === 'testing-ti'){
45
+        if (config('app.env') === 'testing-ti') {
46 46
             $this->app->singleton(OrganizationRepository::class, SqlOrganizationRepository::class);
47 47
             $this->app->singleton(InvitationRepository::class, InMemoryInvitationRepository::class);
48 48
             $this->app->singleton(PictureHandler::class, InMemoryPictureHandler::class);
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
             $this->app->singleton(SocialiteGateway::class, InMemorySocialiteGateway::class);
54 54
         }
55 55
 
56
-        if(config('app.env') === 'local'){
56
+        if (config('app.env') === 'local') {
57 57
             $this->app->singleton(OrganizationRepository::class, SqlOrganizationRepository::class);
58 58
             $this->app->singleton(InvitationRepository::class, InvitationRepositorySql::class);
59 59
             $this->app->singleton(PictureHandler::class, StoragePictureHandler::class);
Please login to merge, or discard this patch.