@@ -51,8 +51,9 @@ |
||
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 | /** |
@@ -71,8 +71,9 @@ |
||
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 | } |
@@ -53,8 +53,9 @@ discard block |
||
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 |
||
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 | } |
@@ -109,14 +109,16 @@ discard block |
||
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 |
||
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 |
@@ -53,10 +53,11 @@ discard block |
||
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 |
||
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 |
||
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 | /** |
@@ -89,11 +89,11 @@ discard block |
||
89 | 89 | try |
90 | 90 | { |
91 | 91 | $events = $this->getEvents(); |
92 | - }catch (\it\thecsea\caldav_client_adapter\CaldavException $e) |
|
92 | + } catch (\it\thecsea\caldav_client_adapter\CaldavException $e) |
|
93 | 93 | { |
94 | 94 | \Event::fire(new CaldavErrorEvent($this->calendar, $e->getMessage())); |
95 | 95 | return ; |
96 | - }catch(\Illuminate\Contracts\Encryption\DecryptException $e){ |
|
96 | + } catch(\Illuminate\Contracts\Encryption\DecryptException $e){ |
|
97 | 97 | \Event::fire(new CaldavErrorEvent($this->calendar, $e->getMessage())); |
98 | 98 | return ; |
99 | 99 | } |
@@ -106,10 +106,11 @@ discard block |
||
106 | 106 | //remove old timeslots |
107 | 107 | $calendarMain->timeslots()->delete(); |
108 | 108 | foreach($events as $event){ |
109 | - if(!($event = $this->parseEvent($event))) |
|
110 | - \Event::fire(new CaldavErrorEvent($this->calendar, 'problem during the parsing an event')); |
|
111 | - else |
|
112 | - $calendarMain->timeslots()->create($event); |
|
109 | + if(!($event = $this->parseEvent($event))) { |
|
110 | + \Event::fire(new CaldavErrorEvent($this->calendar, 'problem during the parsing an event')); |
|
111 | + } else { |
|
112 | + $calendarMain->timeslots()->create($event); |
|
113 | + } |
|
113 | 114 | } |
114 | 115 | } |
115 | 116 | |
@@ -121,17 +122,20 @@ discard block |
||
121 | 122 | { |
122 | 123 | $pattern = "/^((DTSTART;)|(DTEND;))(.*)\$/m"; |
123 | 124 | if(preg_match_all($pattern, $event->getData(), $matches)){ |
124 | - if(!isset($matches[4]) || count($matches[4]) != 2) |
|
125 | - return null; |
|
125 | + if(!isset($matches[4]) || count($matches[4]) != 2) { |
|
126 | + return null; |
|
127 | + } |
|
126 | 128 | $ret = []; |
127 | - if($tmp = $this->parseDate($matches[4][0])) |
|
128 | - $ret['time_start'] = $tmp; |
|
129 | - else |
|
130 | - return null; |
|
131 | - if($tmp = $this->parseDate($matches[4][1])) |
|
132 | - $ret['time_end'] = $tmp; |
|
133 | - else |
|
134 | - return null; |
|
129 | + if($tmp = $this->parseDate($matches[4][0])) { |
|
130 | + $ret['time_start'] = $tmp; |
|
131 | + } else { |
|
132 | + return null; |
|
133 | + } |
|
134 | + if($tmp = $this->parseDate($matches[4][1])) { |
|
135 | + $ret['time_end'] = $tmp; |
|
136 | + } else { |
|
137 | + return null; |
|
138 | + } |
|
135 | 139 | return $ret; |
136 | 140 | } |
137 | 141 | return null; |
@@ -148,7 +152,7 @@ discard block |
||
148 | 152 | if($matches[1][0] == 'TZID=') |
149 | 153 | { |
150 | 154 | return \DateTime::createFromFormat('Ymd\THis', $matches[5][0], new \DateTimeZone($matches[4][0])); |
151 | - }else if($matches[1][0] == 'VALUE=' && $matches[4][0] == 'DATE') |
|
155 | + } else if($matches[1][0] == 'VALUE=' && $matches[4][0] == 'DATE') |
|
152 | 156 | { |
153 | 157 | return \DateTime::createFromFormat('Ymd\THis', $matches[5][0].'T000000'); |
154 | 158 | } |
@@ -105,8 +105,9 @@ discard block |
||
105 | 105 | //TODO validator |
106 | 106 | //TODO check if caldav exists? |
107 | 107 | $caldav = $calendar->caldav; |
108 | - if($caldav) |
|
109 | - $caldav->update($input); |
|
108 | + if($caldav) { |
|
109 | + $caldav->update($input); |
|
110 | + } |
|
110 | 111 | return $calendar; |
111 | 112 | } |
112 | 113 | |
@@ -139,7 +140,7 @@ discard block |
||
139 | 140 | $caldavClient->connect($request->input('url'), $request->input('username'), $request->input('password')); |
140 | 141 | $calendars = $caldavClient->findCalendars(); |
141 | 142 | return array_keys($calendars); |
142 | - }catch (\it\thecsea\caldav_client_adapter\CaldavException $e) |
|
143 | + } catch (\it\thecsea\caldav_client_adapter\CaldavException $e) |
|
143 | 144 | { |
144 | 145 | return Response::json(['error' => $e->getMessage()],422); |
145 | 146 | } |