Completed
Pull Request — master (#10)
by claudio
04:00
created
app/Employee.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
      *
47 47
      * @var string
48 48
      */
49
-     //protected $table = 'employees';
49
+        //protected $table = 'employees';
50 50
 
51 51
     /**
52 52
      * The attributes that are mass assignable.
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -57,14 +57,14 @@  discard block
 block discarded – undo
57 57
      *
58 58
      * @var array
59 59
      */
60
-    protected $fillable = ['name', 'email', 'password'];
60
+    protected $fillable = [ 'name', 'email', 'password' ];
61 61
 
62 62
     /**
63 63
      * The attributes excluded from the model's JSON form.
64 64
      *
65 65
      * @var array
66 66
      */
67
-    protected $hidden = ['password', 'remember_token'];
67
+    protected $hidden = [ 'password', 'remember_token' ];
68 68
 
69 69
     /**
70 70
      * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
@@ -109,16 +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']);
112
+        if (isset($caller[ 'class' ]))
113
+            $caller = explode('\\', $caller[ 'class' ]);
114 114
         else
115 115
             $caller = '';
116 116
 
117 117
         //check if this function is called by email sender
118
-        if ((count($caller) && $caller[count($caller) - 1] == 'PasswordBroker') || (defined('HHVM_VERSION') && $caller == ''))
118
+        if ((count($caller) && $caller[ count($caller) - 1 ] == 'PasswordBroker') || (defined('HHVM_VERSION') && $caller == ''))
119 119
             return $this->email;
120 120
         //return unique identify for token repository
121
-        return $this->email . $this->company->id;
121
+        return $this->email.$this->company->id;
122 122
     }
123 123
 
124 124
     /**
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
     public function belongsToGroup(Group $group)
129 129
     {
130 130
         $group = $this->groups()->where('id', $group->id)->first();
131
-        if(is_object($group) && $group->exists)
131
+        if (is_object($group) && $group->exists)
132 132
             return true;
133 133
         return false;
134 134
     }
Please login to merge, or discard this 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/Group.php 2 patches
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.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -44,21 +44,21 @@
 block discarded – undo
44 44
      *
45 45
      * @var array
46 46
      */
47
-    protected $fillable = ['name', 'description', 'planner_id'];
47
+    protected $fillable = [ 'name', 'description', 'planner_id' ];
48 48
 
49 49
     /**
50 50
      * @var array
51 51
      */
52
-    protected $hidden = ['planner', 'pivot'];
52
+    protected $hidden = [ 'planner', 'pivot' ];
53 53
 
54 54
     /**
55 55
      * @var array
56 56
      */
57
-    protected $appends = ['planner_name'];
57
+    protected $appends = [ 'planner_name' ];
58 58
 
59 59
     public function getPlannerNameAttribute()
60 60
     {
61
-        if(is_object($this->planner) && $this->planner->exists)
61
+        if (is_object($this->planner) && $this->planner->exists)
62 62
             return $this->planner->name;
63 63
         return null;
64 64
     }
Please login to merge, or discard this patch.
app/Http/Controllers/Companies/Groups/EmployeesController.php 3 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.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
      */
22 22
     public function __construct()
23 23
     {
24
-        config(['auth.model' => \plunner\Company::class]);
25
-        config(['jwt.user' => \plunner\Company::class]);
24
+        config([ 'auth.model' => \plunner\Company::class ]);
25
+        config([ 'jwt.user' => \plunner\Company::class ]);
26 26
         $this->middleware('jwt.authandrefresh:mode-cn');
27 27
     }
28 28
 
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
         //
54 54
         $group = Group::findOrFail($groupId);
55 55
         $this->authorize($group);
56
-        $id = $request->all()['id'];
56
+        $id = $request->all()[ 'id' ];
57 57
         $group->employees()->attach($id);
58 58
         return $group->employees;
59 59
     }
@@ -71,8 +71,8 @@  discard block
 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
         $employee->groups()->detach($groupId);
77 77
         return $group->employees;
78 78
     }
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/Planner.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@
 block discarded – undo
61 61
      */
62 62
     public function verifyEmployee(Employee $employee)
63 63
     {
64
-        $group = $this->groupsManaged()->whereHas('employees',function ($query) use ($employee) {$query->where('employees.id', $employee->id);})->first();
64
+        $group = $this->groupsManaged()->whereHas('employees', function($query) use ($employee) {$query->where('employees.id', $employee->id); })->first();
65 65
 
66 66
         return (is_object($group) && $group->exists);
67 67
     }
Please login to merge, or discard this patch.
app/Http/Controllers/Companies/Employees/EmployeesController.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
      */
22 22
     public function __construct()
23 23
     {
24
-        config(['auth.model' => \plunner\Company::class]);
25
-        config(['jwt.user' => \plunner\Company::class]);
24
+        config([ 'auth.model' => \plunner\Company::class ]);
25
+        config([ 'jwt.user' => \plunner\Company::class ]);
26 26
         $this->middleware('jwt.authandrefresh:mode-cn');
27 27
     }
28 28
 
@@ -53,8 +53,8 @@  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
         $employee = $company->employees()->create($input);
59 59
         return $employee;
60 60
     }
@@ -86,8 +86,8 @@  discard block
 block discarded – undo
86 86
         $employee = Employee::findOrFail($id);
87 87
         $this->authorize($employee);
88 88
         $input = $request->all();
89
-        if(isset($input['password']))
90
-            $input['password'] = bcrypt($input['password']);
89
+        if (isset($input[ 'password' ]))
90
+            $input[ 'password' ] = bcrypt($input[ 'password' ]);
91 91
         $employee->update($input);
92 92
         return $employee;
93 93
     }
Please login to merge, or discard this 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/Http/Middleware/VerifyCsrfToken.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
     {
23 23
 
24 24
         // Don't validate CSRF when testing.
25
-        if(env('APP_ENV') === 'testing') {
25
+        if (env('APP_ENV') === 'testing') {
26 26
             return true;
27 27
         }
28 28
 
Please login to merge, or discard this patch.
app/Http/routes.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -18,36 +18,36 @@  discard block
 block discarded – undo
18 18
 /**
19 19
  * Companies
20 20
  */
21
-Route::group(['namespace' => 'Companies', 'prefix' => 'companies'], function() {
21
+Route::group([ 'namespace' => 'Companies', 'prefix' => 'companies' ], function() {
22 22
 
23 23
     //\Auth
24 24
 
25
-    Route::group(['namespace' => 'Auth'], function() {
26
-        Route::group(['prefix' => 'auth'], function () {
25
+    Route::group([ 'namespace' => 'Auth' ], function() {
26
+        Route::group([ 'prefix' => 'auth' ], function() {
27 27
             // Authentication routes...
28
-            Route::post('login', ['as' => 'companies.auth.login','uses'=>'AuthController@postLogin']);
28
+            Route::post('login', [ 'as' => 'companies.auth.login', 'uses'=>'AuthController@postLogin' ]);
29 29
 
30 30
             // Registration routes...
31
-            Route::post('register', ['as' => 'companies.auth.register', 'uses'=>'AuthController@postRegister']);
31
+            Route::post('register', [ 'as' => 'companies.auth.register', 'uses'=>'AuthController@postRegister' ]);
32 32
 
33 33
         });
34 34
 
35
-        Route::group(['prefix' => 'password'], function () {
35
+        Route::group([ 'prefix' => 'password' ], function() {
36 36
             // Password reset link request routes...
37
-            Route::post('email', ['as' => 'companies.auth.email', 'uses'=>'PasswordController@postEmail']);
37
+            Route::post('email', [ 'as' => 'companies.auth.email', 'uses'=>'PasswordController@postEmail' ]);
38 38
 
39 39
             // Password reset routes...
40
-            Route::post('reset', ['as' => 'companies.auth.reset', 'uses'=>'PasswordController@postReset']);
40
+            Route::post('reset', [ 'as' => 'companies.auth.reset', 'uses'=>'PasswordController@postReset' ]);
41 41
         });
42 42
     });
43 43
 
44
-    Route::group(['namespace' => 'Employees'], function() {
45
-        Route::resource('employees', 'EmployeesController', ['except' => ['create', 'edit']]);
44
+    Route::group([ 'namespace' => 'Employees' ], function() {
45
+        Route::resource('employees', 'EmployeesController', [ 'except' => [ 'create', 'edit' ] ]);
46 46
     });
47 47
 
48
-    Route::group(['namespace' => 'Groups'], function() {
49
-        Route::resource('groups', 'GroupsController', ['except' => ['create', 'edit']]);
50
-        Route::resource('groups.employees', 'EmployeesController', ['only' => ['store', 'index', 'destroy']]);
48
+    Route::group([ 'namespace' => 'Groups' ], function() {
49
+        Route::resource('groups', 'GroupsController', [ 'except' => [ 'create', 'edit' ] ]);
50
+        Route::resource('groups.employees', 'EmployeesController', [ 'only' => [ 'store', 'index', 'destroy' ] ]);
51 51
     });
52 52
 });
53 53
 
@@ -55,25 +55,25 @@  discard block
 block discarded – undo
55 55
 /**
56 56
  * Employees
57 57
  */
58
-Route::group(['namespace' => 'Employees', 'prefix' => 'employees'], function() {
58
+Route::group([ 'namespace' => 'Employees', 'prefix' => 'employees' ], function() {
59 59
     //\Auth
60 60
 
61
-    Route::group(['namespace' => 'Auth'], function() {
62
-        Route::group(['prefix' => 'auth'], function () {
61
+    Route::group([ 'namespace' => 'Auth' ], function() {
62
+        Route::group([ 'prefix' => 'auth' ], function() {
63 63
             // Authentication routes...
64
-            Route::post('login', ['as' => 'companies.auth.login', 'uses'=>'AuthController@postLogin']);
64
+            Route::post('login', [ 'as' => 'companies.auth.login', 'uses'=>'AuthController@postLogin' ]);
65 65
 
66 66
             // Registration routes...
67 67
             //Route::post('register', ['as' => 'companies.auth.register', 'uses'=>'AuthController@postRegister']); //the registration is managed by the company
68 68
 
69 69
         });
70 70
 
71
-        Route::group(['prefix' => 'password'], function () {
71
+        Route::group([ 'prefix' => 'password' ], function() {
72 72
             // Password reset link request routes...
73
-            Route::post('email', ['as' => 'companies.auth.email', 'uses'=>'PasswordController@postEmail']);
73
+            Route::post('email', [ 'as' => 'companies.auth.email', 'uses'=>'PasswordController@postEmail' ]);
74 74
 
75 75
             // Password reset routes...
76
-            Route::post('reset', ['as' => 'companies.auth.reset', 'uses'=>'PasswordController@postReset']);
76
+            Route::post('reset', [ 'as' => 'companies.auth.reset', 'uses'=>'PasswordController@postReset' ]);
77 77
         });
78 78
     });
79 79
 });
80 80
\ No newline at end of file
Please login to merge, or discard this patch.
app/Http/Requests/Companies/Employees/EmployeeRequest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
         return [
35 35
             'name' => 'required|max:255',
36 36
             'email' => 'required|email|max:255|unique:employees,email,'.$this->route('employees').',id,company_id,'.$this->user()->id,
37
-            'password' => ((\Route::current()->getName() == 'companies.employees.store')?'required|':'').'confirmed|min:6',
37
+            'password' => ((\Route::current()->getName() == 'companies.employees.store') ? 'required|' : '').'confirmed|min:6',
38 38
         ];
39 39
     }
40 40
 }
Please login to merge, or discard this patch.
app/Console/Commands/SyncCaldav/Sync.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@
 block discarded – undo
64 64
     }
65 65
 
66 66
     /**
67
-     * @return array|\it\thecsea\caldav_client_adapter\EventInterface[]
67
+     * @return EventInterface[]
68 68
      * @throws \it\thecsea\caldav_client_adapter\CaldavException
69 69
      * @thorws \Illuminate\Contracts\Encryption\DecryptException
70 70
      */
Please login to merge, or discard this patch.
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -1,21 +1,21 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Created by PhpStorm.
4
- * User: Claudio Cardinale <[email protected]>
5
- * Date: 03/12/15
6
- * Time: 2.33
7
- * This program is free software; you can redistribute it and/or
8
- * modify it under the terms of the GNU General Public License
9
- * as published by the Free Software Foundation; either version 2
10
- * of the License, or (at your option) any later version.
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
- * GNU General Public License for more details.
15
- * You should have received a copy of the GNU General Public License
16
- * along with this program; if not, write to the Free Software
17
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18
- */
3
+     * Created by PhpStorm.
4
+     * User: Claudio Cardinale <[email protected]>
5
+     * Date: 03/12/15
6
+     * Time: 2.33
7
+     * This program is free software; you can redistribute it and/or
8
+     * modify it under the terms of the GNU General Public License
9
+     * as published by the Free Software Foundation; either version 2
10
+     * of the License, or (at your option) any later version.
11
+     * This program is distributed in the hope that it will be useful,
12
+     * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
+     * GNU General Public License for more details.
15
+     * You should have received a copy of the GNU General Public License
16
+     * along with this program; if not, write to the Free Software
17
+     * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18
+     */
19 19
 
20 20
 namespace plunner\Console\Commands\SyncCaldav;
21 21
 
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -73,12 +73,12 @@  discard block
 block discarded – undo
73 73
         $caldavClient = new SimpleCaldavAdapter();
74 74
         $caldavClient->connect($this->calendar->url, $this->calendar->username, \Crypt::decrypt($this->calendar->password));
75 75
         $calendars = $caldavClient->findCalendars();
76
-        $caldavClient->setCalendar($calendars[$this->calendar->calendar_name]);
76
+        $caldavClient->setCalendar($calendars[ $this->calendar->calendar_name ]);
77 77
         /**
78 78
          * 26 hours before to avoid tiemezone problems and dst problems
79 79
          * 30 days after
80 80
          */
81
-        return $caldavClient->getEvents(date('Ymd\THis\Z', time()-93600), date('Ymd\THis\Z', time()+2592000));
81
+        return $caldavClient->getEvents(date('Ymd\THis\Z', time() - 93600), date('Ymd\THis\Z', time() + 2592000));
82 82
     }
83 83
 
84 84
     /**
@@ -89,10 +89,10 @@  discard block
 block discarded – undo
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
-        }catch(\Illuminate\Contracts\Encryption\DecryptException $e){
95
+        } catch (\Illuminate\Contracts\Encryption\DecryptException $e) {
96 96
             \Event::fire(new CaldavErrorEvent($this->calendar, $e->getMessage()));
97 97
         }
98 98
 
@@ -103,8 +103,8 @@  discard block
 block discarded – undo
103 103
 
104 104
         //remove old timeslots
105 105
         $calendarMain->timeslots()->delete();
106
-        foreach($events as $event){
107
-            if(!($event = $this->parseEvent($event)))
106
+        foreach ($events as $event) {
107
+            if (!($event = $this->parseEvent($event)))
108 108
                 \Event::fire(new CaldavErrorEvent($this->calendar, 'problem during the parsing an event'));
109 109
             $calendarMain->timeslots()->create($event);
110 110
         }
@@ -117,16 +117,16 @@  discard block
 block discarded – undo
117 117
     private function parseEvent(EventInterface $event)
118 118
     {
119 119
         $pattern = "/^((DTSTART;)|(DTEND;))(.*)\$/m";
120
-        if(preg_match_all($pattern, $event->getData(), $matches)){
121
-            if(!isset($matches[4]) || count($matches[4]) != 2)
120
+        if (preg_match_all($pattern, $event->getData(), $matches)) {
121
+            if (!isset($matches[ 4 ]) || count($matches[ 4 ]) != 2)
122 122
                 return null;
123
-            $ret = [];
124
-            if($tmp = $this->parseDate($matches[4][0]))
125
-                $ret['time_start'] = $tmp;
123
+            $ret = [ ];
124
+            if ($tmp = $this->parseDate($matches[ 4 ][ 0 ]))
125
+                $ret[ 'time_start' ] = $tmp;
126 126
             else
127 127
                 return null;
128
-            if($tmp = $this->parseDate($matches[4][1]))
129
-                $ret['time_end'] = $tmp;
128
+            if ($tmp = $this->parseDate($matches[ 4 ][ 1 ]))
129
+                $ret[ 'time_end' ] = $tmp;
130 130
             else
131 131
                 return null;
132 132
             return $ret;
@@ -141,13 +141,13 @@  discard block
 block discarded – undo
141 141
     private function parseDate($date)
142 142
     {
143 143
         $pattern = "/^((TZID=)|(VALUE=))(.*):(.*)\$/m";
144
-        if(preg_match_all($pattern, $date, $matches)){
145
-            if($matches[1][0] == 'TZID=')
144
+        if (preg_match_all($pattern, $date, $matches)) {
145
+            if ($matches[ 1 ][ 0 ] == 'TZID=')
146 146
             {
147
-                return \DateTime::createFromFormat('Ymd\THis', $matches[5][0], new \DateTimeZone($matches[4][0]));
148
-            }else if($matches[1][0] == 'VALUE=' && $matches[4][0] == 'DATE')
147
+                return \DateTime::createFromFormat('Ymd\THis', $matches[ 5 ][ 0 ], new \DateTimeZone($matches[ 4 ][ 0 ]));
148
+            } else if ($matches[ 1 ][ 0 ] == 'VALUE=' && $matches[ 4 ][ 0 ] == 'DATE')
149 149
             {
150
-                return \DateTime::createFromFormat('Ymd\THis', $matches[5][0].'T000000');
150
+                return \DateTime::createFromFormat('Ymd\THis', $matches[ 5 ][ 0 ].'T000000');
151 151
             }
152 152
         }
153 153
         return null;
Please login to merge, or discard this patch.
Braces   +19 added lines, -15 removed lines patch added patch discarded remove patch
@@ -89,10 +89,10 @@  discard block
 block discarded – undo
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
-        }catch(\Illuminate\Contracts\Encryption\DecryptException $e){
95
+        } catch(\Illuminate\Contracts\Encryption\DecryptException $e){
96 96
             \Event::fire(new CaldavErrorEvent($this->calendar, $e->getMessage()));
97 97
         }
98 98
 
@@ -104,8 +104,9 @@  discard block
 block discarded – undo
104 104
         //remove old timeslots
105 105
         $calendarMain->timeslots()->delete();
106 106
         foreach($events as $event){
107
-            if(!($event = $this->parseEvent($event)))
108
-                \Event::fire(new CaldavErrorEvent($this->calendar, 'problem during the parsing an event'));
107
+            if(!($event = $this->parseEvent($event))) {
108
+                            \Event::fire(new CaldavErrorEvent($this->calendar, 'problem during the parsing an event'));
109
+            }
109 110
             $calendarMain->timeslots()->create($event);
110 111
         }
111 112
     }
@@ -118,17 +119,20 @@  discard block
 block discarded – undo
118 119
     {
119 120
         $pattern = "/^((DTSTART;)|(DTEND;))(.*)\$/m";
120 121
         if(preg_match_all($pattern, $event->getData(), $matches)){
121
-            if(!isset($matches[4]) || count($matches[4]) != 2)
122
-                return null;
122
+            if(!isset($matches[4]) || count($matches[4]) != 2) {
123
+                            return null;
124
+            }
123 125
             $ret = [];
124
-            if($tmp = $this->parseDate($matches[4][0]))
125
-                $ret['time_start'] = $tmp;
126
-            else
127
-                return null;
128
-            if($tmp = $this->parseDate($matches[4][1]))
129
-                $ret['time_end'] = $tmp;
130
-            else
131
-                return null;
126
+            if($tmp = $this->parseDate($matches[4][0])) {
127
+                            $ret['time_start'] = $tmp;
128
+            } else {
129
+                            return null;
130
+            }
131
+            if($tmp = $this->parseDate($matches[4][1])) {
132
+                            $ret['time_end'] = $tmp;
133
+            } else {
134
+                            return null;
135
+            }
132 136
             return $ret;
133 137
         }
134 138
         return null;
@@ -145,7 +149,7 @@  discard block
 block discarded – undo
145 149
             if($matches[1][0] == 'TZID=')
146 150
             {
147 151
                 return \DateTime::createFromFormat('Ymd\THis', $matches[5][0], new \DateTimeZone($matches[4][0]));
148
-            }else if($matches[1][0] == 'VALUE=' && $matches[4][0] == 'DATE')
152
+            } else if($matches[1][0] == 'VALUE=' && $matches[4][0] == 'DATE')
149 153
             {
150 154
                 return \DateTime::createFromFormat('Ymd\THis', $matches[5][0].'T000000');
151 155
             }
Please login to merge, or discard this patch.