Completed
Push — master ( 848848...fe7ae6 )
by claudio
09:33
created
app/Console/Commands/SyncCaldav/Sync.php 1 patch
Braces   +21 added lines, -16 removed lines patch added patch discarded remove patch
@@ -90,10 +90,11 @@  discard block
 block discarded – undo
90 90
 
91 91
         //insert new timeslots
92 92
         foreach ($events as $event) {
93
-            if (!($event = $this->parseEvent($event)))
94
-                \Event::fire(new ErrorEvent($this->calendar, 'problem during the parsing an event'));
95
-            else
96
-                $calendarMain->timeslots()->create($event);
93
+            if (!($event = $this->parseEvent($event))) {
94
+                            \Event::fire(new ErrorEvent($this->calendar, 'problem during the parsing an event'));
95
+            } else {
96
+                            $calendarMain->timeslots()->create($event);
97
+            }
97 98
         }
98 99
         \Event::fire(new OkEvent($this->calendar));
99 100
     }
@@ -110,8 +111,9 @@  discard block
 block discarded – undo
110 111
         $caldavClient = new SimpleCaldavAdapter();
111 112
         $caldavClient->connect($this->calendar->url, $this->calendar->username, \Crypt::decrypt($this->calendar->password));
112 113
         $calendars = $caldavClient->findCalendars();
113
-        if(!isset($calendars[$this->calendar->calendar_name]))
114
-            throw new CaldavException("calendar inserted doesn't exist");
114
+        if(!isset($calendars[$this->calendar->calendar_name])) {
115
+                    throw new CaldavException("calendar inserted doesn't exist");
116
+        }
115 117
         $caldavClient->setCalendar($calendars[$this->calendar->calendar_name]);//TODO error if the calendar name is wrong
116 118
         /**
117 119
          * 26 hours before to avoid tiemezone problems and dst problems
@@ -128,17 +130,20 @@  discard block
 block discarded – undo
128 130
     {
129 131
         $pattern = "/^((DTSTART;)|(DTEND;))(.*)\$/m";
130 132
         if (preg_match_all($pattern, $event->getData(), $matches)) {
131
-            if (!isset($matches[4]) || count($matches[4]) != 2)
132
-                return null;
133
+            if (!isset($matches[4]) || count($matches[4]) != 2) {
134
+                            return null;
135
+            }
133 136
             $ret = [];
134
-            if ($tmp = $this->parseDate($matches[4][0]))
135
-                $ret['time_start'] = $tmp;
136
-            else
137
-                return null;
138
-            if ($tmp = $this->parseDate($matches[4][1]))
139
-                $ret['time_end'] = $tmp;
140
-            else
141
-                return null;
137
+            if ($tmp = $this->parseDate($matches[4][0])) {
138
+                            $ret['time_start'] = $tmp;
139
+            } else {
140
+                            return null;
141
+            }
142
+            if ($tmp = $this->parseDate($matches[4][1])) {
143
+                            $ret['time_end'] = $tmp;
144
+            } else {
145
+                            return null;
146
+            }
142 147
             return $ret;
143 148
         }
144 149
         return null;
Please login to merge, or discard this patch.