Completed
Push — master ( 848848...fe7ae6 )
by claudio
09:33
created
app/Console/Commands/SyncCaldav/Sync.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -110,9 +110,9 @@  discard block
 block discarded – undo
110 110
         $caldavClient = new SimpleCaldavAdapter();
111 111
         $caldavClient->connect($this->calendar->url, $this->calendar->username, \Crypt::decrypt($this->calendar->password));
112 112
         $calendars = $caldavClient->findCalendars();
113
-        if(!isset($calendars[$this->calendar->calendar_name]))
113
+        if (!isset($calendars[ $this->calendar->calendar_name ]))
114 114
             throw new CaldavException("calendar inserted doesn't exist");
115
-        $caldavClient->setCalendar($calendars[$this->calendar->calendar_name]);//TODO error if the calendar name is wrong
115
+        $caldavClient->setCalendar($calendars[ $this->calendar->calendar_name ]); //TODO error if the calendar name is wrong
116 116
         /**
117 117
          * 26 hours before to avoid tiemezone problems and dst problems
118 118
          * 30 days after
@@ -128,15 +128,15 @@  discard block
 block discarded – undo
128 128
     {
129 129
         $pattern = "/^((DTSTART;)|(DTEND;))(.*)\$/m";
130 130
         if (preg_match_all($pattern, $event->getData(), $matches)) {
131
-            if (!isset($matches[4]) || count($matches[4]) != 2)
131
+            if (!isset($matches[ 4 ]) || count($matches[ 4 ]) != 2)
132 132
                 return null;
133
-            $ret = [];
134
-            if ($tmp = $this->parseDate($matches[4][0]))
135
-                $ret['time_start'] = $tmp;
133
+            $ret = [ ];
134
+            if ($tmp = $this->parseDate($matches[ 4 ][ 0 ]))
135
+                $ret[ 'time_start' ] = $tmp;
136 136
             else
137 137
                 return null;
138
-            if ($tmp = $this->parseDate($matches[4][1]))
139
-                $ret['time_end'] = $tmp;
138
+            if ($tmp = $this->parseDate($matches[ 4 ][ 1 ]))
139
+                $ret[ 'time_end' ] = $tmp;
140 140
             else
141 141
                 return null;
142 142
             return $ret;
@@ -152,10 +152,10 @@  discard block
 block discarded – undo
152 152
     {
153 153
         $pattern = "/^((TZID=)|(VALUE=))(.*):(.*)\$/m";
154 154
         if (preg_match_all($pattern, $date, $matches)) {
155
-            if ($matches[1][0] == 'TZID=') {
156
-                return \DateTime::createFromFormat('Ymd\THis', $matches[5][0], new \DateTimeZone($matches[4][0]));
157
-            } else if ($matches[1][0] == 'VALUE=' && $matches[4][0] == 'DATE') {
158
-                return \DateTime::createFromFormat('Ymd\THis', $matches[5][0] . 'T000000');
155
+            if ($matches[ 1 ][ 0 ] == 'TZID=') {
156
+                return \DateTime::createFromFormat('Ymd\THis', $matches[ 5 ][ 0 ], new \DateTimeZone($matches[ 4 ][ 0 ]));
157
+            } else if ($matches[ 1 ][ 0 ] == 'VALUE=' && $matches[ 4 ][ 0 ] == 'DATE') {
158
+                return \DateTime::createFromFormat('Ymd\THis', $matches[ 5 ][ 0 ].'T000000');
159 159
             }
160 160
         }
161 161
         return null;
Please login to merge, or discard this patch.