Test Setup Failed
Push — master ( b0c301...fb80ed )
by guillaume
01:15 queued 13s
created
app/Src/UseCases/Organizations/GrantUserAsAdminOrganization.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 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
 
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
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
     public function adminlte_image()
29 29
     {
30 30
         $urlPicture = $this->path_picture != "" ? asset('storage/'.str_replace('app/public/', '', $this->path_picture)) : null;
31
-        if($urlPicture === ""){
31
+        if ($urlPicture === "") {
32 32
             $urlPicture = 'http://dev.core.tripleperformance.com:8008/vendor/adminlte/dist/img/AdminLTELogo.png';
33 33
         }
34 34
         return $urlPicture;
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     public function adminlte_desc()
38 38
     {
39 39
         $desc = ucfirst($this->firstname).' '.ucfirst($this->lastname);
40
-        if($this->organization_id !== null){
40
+        if ($this->organization_id !== null) {
41 41
             $organization = app(OrganizationRepository::class)->get($this->organization_id);
42 42
             $desc .= ' - organisme : '.$organization->name();
43 43
         }
Please login to merge, or discard this patch.
app/Src/UseCases/Infra/InMemory/InMemoryUserRepository.php 1 patch
Spacing   +14 added lines, -14 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;
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
         }
Please login to merge, or discard this patch.
app/Src/UseCases/Domain/User.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
         return ucfirst($this->firstname).' '.ucfirst($this->lastname);
46 46
     }
47 47
 
48
-    public function organizationId():?string
48
+    public function organizationId(): ?string
49 49
     {
50 50
         return $this->organizationId;
51 51
     }
@@ -89,10 +89,10 @@  discard block
 block discarded – undo
89 89
         $this->email = $email;
90 90
         $this->firstname = $firstname;
91 91
         $this->lastname = $lastname;
92
-        if($pathPicture !== "") {
92
+        if ($pathPicture !== "") {
93 93
             $picture = new Picture($pathPicture);
94
-            $picture->resize('app/public/users/' . $this->id . '.' . $ext);
95
-            $this->pathPicture = 'app/public/users/' . $this->id . '.' . $ext;
94
+            $picture->resize('app/public/users/'.$this->id.'.'.$ext);
95
+            $this->pathPicture = 'app/public/users/'.$this->id.'.'.$ext;
96 96
         }
97 97
         app(UserRepository::class)->update($this);
98 98
     }
Please login to merge, or discard this patch.
app/Src/UseCases/Infra/Sql/UserRepositorySql.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
     public function getByEmail(string $email): ?User
13 13
     {
14 14
         $record = \App\User::where('email', $email)->first();
15
-        if(!isset($record)){
15
+        if (!isset($record)) {
16 16
             return null;
17 17
         }
18 18
         $roles = $record->roles()->pluck('name')->toArray();
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
     public function getById(string $id): ?User
23 23
     {
24 24
         $record = \App\User::where('uuid', $id)->first();
25
-        if(!isset($record)){
25
+        if (!isset($record)) {
26 26
             return null;
27 27
         }
28 28
         $roles = $record->roles()->pluck('name')->toArray();
@@ -67,11 +67,11 @@  discard block
 block discarded – undo
67 67
             ->offset(($page-1)*$perPage)
68 68
             ->limit($perPage)
69 69
             ->get();
70
-        if(empty($records)){
70
+        if (empty($records)) {
71 71
             return [];
72 72
         }
73 73
         $users = [];
74
-        foreach($records as $record){
74
+        foreach ($records as $record) {
75 75
             $roles = \App\User::find($record->id)->roles()->pluck('name')->toArray();
76 76
             $users[] = new User($record->uuid, $record->email, $record->firstname, $record->lastname, $record->organization_id, $record->path_picture, $roles);
77 77
         }
@@ -90,11 +90,11 @@  discard block
 block discarded – undo
90 90
     public function getAdminOfOrganization(string $organizationId): array
91 91
     {
92 92
         $records = \App\User::role(['admin'])->where('organization_id', $organizationId)->get();
93
-        if(empty($records)){
93
+        if (empty($records)) {
94 94
             return [];
95 95
         }
96 96
         $users = [];
97
-        foreach($records as $record){
97
+        foreach ($records as $record) {
98 98
             $roles = \App\User::find($record->id)->roles()->pluck('name')->toArray();
99 99
             $users[] = new User($record->uuid, $record->email, $record->firstname, $record->lastname, $record->organization_id, $record->path_picture, $roles);
100 100
         }
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
@@ -24,12 +24,12 @@  discard block
 block discarded – undo
24 24
 
25 25
     public function listUsers(string $organizationId, Request $request, ListUsers $listUsers)
26 26
     {
27
-        $page = $request->input('start')/10 + 1;
27
+        $page = $request->input('start')/10+1;
28 28
 
29 29
         $users = $listUsers->list($organizationId, $page, 10);
30 30
         $total = isset($users['total']) ? $users['total'] : 0;
31 31
         $list = [];
32
-        foreach ($users['list'] as $user){
32
+        foreach ($users['list'] as $user) {
33 33
             $user = $user->toArray();
34 34
             $list[] = [
35 35
                 '',
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
     public function editShowForm(string $userId, GetUser $getUser, GetOrganization $getOrganization)
55 55
     {
56 56
         $user = $getUser->get($userId);
57
-        if($user->organizationId() !== null) {
57
+        if ($user->organizationId() !== null) {
58 58
             $organization = $getOrganization->get($user->organizationId());
59 59
         }
60 60
         return view('users/edit_form', [
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         $lastname = $request->input('lastname') !== null ? $request->input('lastname') : '';
70 70
         $email = $request->input('email') !== null ? $request->input('email') : '';
71 71
         $picture = [];
72
-        if($request->has('logo')){
72
+        if ($request->has('logo')) {
73 73
             $picture['path_picture'] = $request->file('logo')->path();
74 74
             $picture['original_name'] = $request->file('logo')->getClientOriginalName();
75 75
             $picture['mine_type'] = $request->file('logo')->getMimeType();
@@ -96,11 +96,11 @@  discard block
 block discarded – undo
96 96
     public function delete(string $userId, Request $request, DeleteUser $deleteUser)
97 97
     {
98 98
         $redirect = 'back';
99
-        if($userId === Auth::id()){
99
+        if ($userId === Auth::id()) {
100 100
             $redirect = 'login';
101 101
         }
102 102
         $deleteUser->delete($userId);
103
-        if($redirect === 'login') {
103
+        if ($redirect === 'login') {
104 104
             return redirect()->route('login');
105 105
         }
106 106
         $request->session()->flash('notif_msg', 'L\'utilisateur a été supprimé');
Please login to merge, or discard this patch.