Completed
Push — master ( 090677...bcfcea )
by guillaume
24:23 queued 24:23
created
app/Src/UseCases/Organizations/RevokeUserAsAdminOrganization.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 revoke(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/Src/UseCases/Organizations/EditOrganization.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
     public function edit(string $organizationId, string $name, array $picture, array $address)
22 22
     {
23 23
         $organization = $this->organizationRepository->get($organizationId);
24
-        if(!isset($organization)){
24
+        if (!isset($organization)) {
25 25
             throw new OrganizationNotFound();
26 26
         }
27 27
         $this->validateData($name, $picture, $address);
Please login to merge, or discard this patch.
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   +12 added lines, -12 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
         }
Please login to merge, or discard this patch.
app/Http/Controllers/UsersController.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -23,12 +23,12 @@  discard block
 block discarded – undo
23 23
 
24 24
     public function listUsers(string $organizationId, Request $request, ListUsers $listUsers)
25 25
     {
26
-        $page = $request->input('start')/10 + 1;
26
+        $page = $request->input('start')/10+1;
27 27
 
28 28
         $users = $listUsers->list($organizationId, $page, 10);
29 29
         $total = isset($users['total']) ? $users['total'] : 0;
30 30
         $list = [];
31
-        foreach ($users['list'] as $user){
31
+        foreach ($users['list'] as $user) {
32 32
             $user = $user->toArray();
33 33
             $list[] = [
34 34
                 '',
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
         $lastname = $request->input('lastname') !== null ? $request->input('lastname') : '';
67 67
         $email = $request->input('email') !== null ? $request->input('email') : '';
68 68
         $picture = [];
69
-        if($request->has('logo')){
69
+        if ($request->has('logo')) {
70 70
             $picture['path_picture'] = $request->file('logo')->path();
71 71
             $picture['original_name'] = $request->file('logo')->getClientOriginalName();
72 72
             $picture['mine_type'] = $request->file('logo')->getMimeType();
@@ -93,11 +93,11 @@  discard block
 block discarded – undo
93 93
     public function delete(string $userId, Request $request, DeleteUser $deleteUser)
94 94
     {
95 95
         $redirect = 'back';
96
-        if($userId === Auth::id()){
96
+        if ($userId === Auth::id()) {
97 97
             $redirect = 'login';
98 98
         }
99 99
         $deleteUser->delete($userId);
100
-        if($redirect === 'login') {
100
+        if ($redirect === 'login') {
101 101
             return redirect()->route('login');
102 102
         }
103 103
         $request->session()->flash('notif_msg', 'L\'utilisateur a été supprimé');
Please login to merge, or discard this patch.