Completed
Pull Request — master (#42)
by claudio
03:15
created
app/Http/Controllers/Companies/Auth/AuthController.php 2 patches
Unused Use Statements   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -2,11 +2,11 @@
 block discarded – undo
2 2
 
3 3
 namespace plunner\Http\Controllers\Companies\Auth;
4 4
 
5
-use plunner\Company;
6
-use Validator;
7
-use plunner\Http\Controllers\Controller;
8 5
 use Tymon\JWTAuth\Support\auth\AuthenticatesAndRegistersUsers;
9 6
 use Tymon\JWTAuth\Support\auth\ThrottlesLogins;
7
+use Validator;
8
+use plunner\Company;
9
+use plunner\Http\Controllers\Controller;
10 10
 
11 11
 class AuthController extends Controller
12 12
 {
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -90,8 +90,9 @@
 block discarded – undo
90 90
         {
91 91
             config(['jwt.ttl' =>'43200']); //30 days
92 92
             $this->custom = array_merge($this->custom, ['remember'=>'true']);
93
-        }else
94
-            $this->custom = array_merge($this->custom, ['remember'=>'false']);
93
+        } else {
94
+                    $this->custom = array_merge($this->custom, ['remember'=>'false']);
95
+        }
95 96
         return $this->postLoginOriginal($request);
96 97
     }
97 98
 
Please login to merge, or discard this patch.
app/Http/Controllers/Employees/Auth/AuthController.php 2 patches
Unused Use Statements   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -3,13 +3,12 @@
 block discarded – undo
3 3
 namespace plunner\Http\Controllers\Employees\Auth;
4 4
 
5 5
 use Illuminate\Http\Request;
6
-use plunner\Company;
7
-use plunner\employee;
8
-use Validator;
9
-use plunner\Http\Controllers\Controller;
10 6
 use Tymon\JWTAuth\Support\auth\AuthenticatesAndRegistersUsers;
11 7
 use Tymon\JWTAuth\Support\auth\ThrottlesLogins;
12
-use Log;
8
+use Validator;
9
+use plunner\Company;
10
+use plunner\Http\Controllers\Controller;
11
+use plunner\employee;
13 12
 
14 13
 class AuthController extends Controller
15 14
 {
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -111,8 +111,9 @@
 block discarded – undo
111 111
         {
112 112
             config(['jwt.ttl' =>'43200']); //30 days
113 113
             $this->custom = array_merge($this->custom, ['remember'=>'true']);
114
-        }else
115
-            $this->custom = array_merge($this->custom, ['remember'=>'false']);
114
+        } else {
115
+                    $this->custom = array_merge($this->custom, ['remember'=>'false']);
116
+        }
116 117
 
117 118
         return $this->postLoginOriginal($request);
118 119
     }
Please login to merge, or discard this patch.
app/Group.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,8 +51,9 @@
 block discarded – undo
51 51
 
52 52
     public function getPlannerNameAttribute()
53 53
     {
54
-        if(is_object($this->planner) && $this->planner->exists)
55
-            return $this->planner->name;
54
+        if(is_object($this->planner) && $this->planner->exists) {
55
+                    return $this->planner->name;
56
+        }
56 57
     }
57 58
 
58 59
     /**
Please login to merge, or discard this patch.
app/Http/Controllers/Companies/Groups/EmployeesController.php 2 patches
Unused Use Statements   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@
 block discarded – undo
3 3
 namespace plunner\Http\Controllers\Companies\Groups;
4 4
 
5 5
 use Illuminate\Support\Facades\Response;
6
-use plunner\Group;
7 6
 use plunner\Employee;
7
+use plunner\Group;
8 8
 use plunner\Http\Controllers\Controller;
9 9
 use plunner\Http\Requests\Companies\Groups\EmployeeRequest;
10 10
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -71,8 +71,9 @@
 block discarded – undo
71 71
         $employee = Employee::findOrFail($employeeId);
72 72
         $this->authorize($employee);
73 73
         $group = Group::findOrFail($groupId);
74
-        if(!$employee->belongsToGroup($group))
75
-            return Response::json(['error' => 'employId <> groupId'],404);
74
+        if(!$employee->belongsToGroup($group)) {
75
+                    return Response::json(['error' => 'employId <> groupId'],404);
76
+        }
76 77
         $employee->groups()->detach($groupId);
77 78
         return $group->employees;
78 79
     }
Please login to merge, or discard this patch.
app/Http/Controllers/Companies/Employees/EmployeesController.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -53,8 +53,9 @@  discard block
 block discarded – undo
53 53
         //
54 54
         $company = \Auth::user();
55 55
         $input = $request->all();
56
-        if(isset($input['password']))
57
-            $input['password'] = bcrypt($input['password']);
56
+        if(isset($input['password'])) {
57
+                    $input['password'] = bcrypt($input['password']);
58
+        }
58 59
         $employee = $company->employees()->create($input);
59 60
         return $employee;
60 61
     }
@@ -86,8 +87,9 @@  discard block
 block discarded – undo
86 87
         $employee = Employee::findOrFail($id);
87 88
         $this->authorize($employee);
88 89
         $input = $request->all();
89
-        if(isset($input['password']))
90
-            $input['password'] = bcrypt($input['password']);
90
+        if(isset($input['password'])) {
91
+                    $input['password'] = bcrypt($input['password']);
92
+        }
91 93
         $employee->update($input);
92 94
         return $employee;
93 95
     }
Please login to merge, or discard this patch.
app/Employee.php 1 patch
Braces   +11 added lines, -8 removed lines patch added patch discarded remove patch
@@ -109,14 +109,16 @@  discard block
 block discarded – undo
109 109
     public function getEmailForPasswordReset()
110 110
     {
111 111
         list(, $caller) = debug_backtrace(false);
112
-        if(isset($caller['class']))
113
-            $caller = explode('\\', $caller['class']);
114
-        else
115
-            $caller = '';
112
+        if(isset($caller['class'])) {
113
+                    $caller = explode('\\', $caller['class']);
114
+        } else {
115
+                    $caller = '';
116
+        }
116 117
 
117 118
         //check if this function is called by email sender
118
-        if ((count($caller) && $caller[count($caller) - 1] == 'PasswordBroker') || (defined('HHVM_VERSION') && $caller == ''))
119
-            return $this->email;
119
+        if ((count($caller) && $caller[count($caller) - 1] == 'PasswordBroker') || (defined('HHVM_VERSION') && $caller == '')) {
120
+                    return $this->email;
121
+        }
120 122
         //return unique identify for token repository
121 123
         return $this->email . $this->company->id;
122 124
     }
@@ -128,8 +130,9 @@  discard block
 block discarded – undo
128 130
     public function belongsToGroup(Group $group)
129 131
     {
130 132
         $group = $this->groups()->where('id', $group->id)->first();
131
-        if(is_object($group) && $group->exists)
132
-            return true;
133
+        if(is_object($group) && $group->exists) {
134
+                    return true;
135
+        }
133 136
         return false;
134 137
     }
135 138
 
Please login to merge, or discard this patch.
app/Console/Commands/SyncCaldav/SyncCaldav.php 1 patch
Braces   +14 added lines, -10 removed lines patch added patch discarded remove patch
@@ -53,10 +53,11 @@  discard block
 block discarded – undo
53 53
     {
54 54
         //
55 55
         $calendarId = $this->argument('calendarId');
56
-        if(is_numeric($calendarId))
57
-            $this->makeForeground(Caldav::findOrFail($calendarId));
58
-        else
59
-            $this->syncAll();
56
+        if(is_numeric($calendarId)) {
57
+                    $this->makeForeground(Caldav::findOrFail($calendarId));
58
+        } else {
59
+                    $this->syncAll();
60
+        }
60 61
     }
61 62
 
62 63
     private function syncAll()
@@ -65,13 +66,15 @@  discard block
 block discarded – undo
65 66
         if($this->option('background')) {
66 67
             \Log::debug(self::BACKGROUND_MOD_MEX);
67 68
             $this->info(self::BACKGROUND_MOD_MEX);
68
-            foreach ($calendars as $calendar)
69
-                $this->makeBackground($calendar);
69
+            foreach ($calendars as $calendar) {
70
+                            $this->makeBackground($calendar);
71
+            }
70 72
             \Log::debug(self::BACKGROUND_COMPLETED_MEX);
71 73
             $this->info(self::BACKGROUND_COMPLETED_MEX);
72
-        }else
73
-            foreach($calendars as $calendar)
74
+        } else {
75
+                    foreach($calendars as $calendar)
74 76
                 $this->makeForeground($calendar);
77
+        }
75 78
     }
76 79
 
77 80
     /**
@@ -81,8 +84,9 @@  discard block
 block discarded – undo
81 84
     private function makeBackground(Caldav $calendar)
82 85
     {
83 86
         $event = $this->schedule->command('sync:caldav '.$calendar->calendar_id)->withoutOverlapping();
84
-        if($event->isDue($this->laravel))
85
-             $event->run($this->laravel);
87
+        if($event->isDue($this->laravel)) {
88
+                     $event->run($this->laravel);
89
+        }
86 90
     }
87 91
 
88 92
     /**
Please login to merge, or discard this patch.
app/Http/Controllers/Employees/Groups/GroupsController.php 1 patch
Unused Use Statements   +1 added lines, -4 removed lines patch added patch discarded remove patch
@@ -2,11 +2,8 @@
 block discarded – undo
2 2
 
3 3
 namespace plunner\Http\Controllers\Employees;
4 4
 
5
-use Illuminate\Http\Request;
6
-
7
-use plunner\Group;
8 5
 use plunner\Employee;
9
-use plunner\Http\Requests;
6
+use plunner\Group;
10 7
 use plunner\Http\Controllers\Controller;
11 8
 
12 9
 class GroupsController extends Controller
Please login to merge, or discard this patch.
app/Http/Controllers/Employees/Calendars/CalendarsController.php 1 patch
Braces   +10 added lines, -7 removed lines patch added patch discarded remove patch
@@ -66,8 +66,9 @@  discard block
 block discarded – undo
66 66
         $employee = \Auth::user();
67 67
         $input = $request->all();
68 68
         $calendar = $employee->calendars()->create($input);
69
-        if(isset($input['password']))
70
-            $input['password'] = \Crypt::encrypt($input['password']);
69
+        if(isset($input['password'])) {
70
+                    $input['password'] = \Crypt::encrypt($input['password']);
71
+        }
71 72
         $calendar->caldav()->create($input);
72 73
         //TODO test
73 74
         //TODO validator
@@ -107,15 +108,17 @@  discard block
 block discarded – undo
107 108
         if($caldav){
108 109
             $this->validateCaldav($request);
109 110
         }
110
-        if(isset($input['password']))
111
-            $input['password'] = \Crypt::encrypt($input['password']);
111
+        if(isset($input['password'])) {
112
+                    $input['password'] = \Crypt::encrypt($input['password']);
113
+        }
112 114
         $calendar->update($input);
113 115
         //TODO test
114 116
         //TODO validator
115 117
         //TODO check if caldav exists?
116 118
 
117
-        if($caldav)
118
-            $caldav->update($input);
119
+        if($caldav) {
120
+                    $caldav->update($input);
121
+        }
119 122
         return $calendar;
120 123
     }
121 124
 
@@ -148,7 +151,7 @@  discard block
 block discarded – undo
148 151
             $caldavClient->connect($request->input('url'), $request->input('username'), $request->input('password'));
149 152
             $calendars = $caldavClient->findCalendars();
150 153
             return array_keys($calendars);
151
-        }catch (\it\thecsea\caldav_client_adapter\CaldavException $e)
154
+        } catch (\it\thecsea\caldav_client_adapter\CaldavException $e)
152 155
         {
153 156
             return Response::json(['error' => $e->getMessage()],422);
154 157
         }
Please login to merge, or discard this patch.