Completed
Pull Request — master (#28)
by claudio
05:35
created
app/Listeners/Optimise/OkListener.php 1 patch
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -3,8 +3,6 @@
 block discarded – undo
3 3
 namespace plunner\Listeners;
4 4
 
5 5
 use plunner\Events\CaldavErrorEvent;
6
-use Illuminate\Queue\InteractsWithQueue;
7
-use Illuminate\Contracts\Queue\ShouldQueue;
8 6
 
9 7
 class CaldavErrorListener
10 8
 {
Please login to merge, or discard this patch.
app/Console/Commands/Optimise/OptimiseCommand.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,8 +32,8 @@
 block discarded – undo
32 32
     protected $description = 'Optimise meetings';
33 33
 
34 34
     /**
35
-    * @var Schedule laravel schedule object needed to perform command in background
36
-    */
35
+     * @var Schedule laravel schedule object needed to perform command in background
36
+     */
37 37
     private $schedule;
38 38
 
39 39
     /**
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 
63 63
         //TODO try...catch with destruct
64 64
         $companyId = $this->argument('companyId');
65
-        if(is_numeric($companyId))
65
+        if (is_numeric($companyId))
66 66
             $this->makeForeground(Company::findOrFail($companyId));
67 67
         else
68 68
             $this->syncAll();
@@ -71,15 +71,15 @@  discard block
 block discarded – undo
71 71
     private function syncAll()
72 72
     {
73 73
         $calendars = Caldav::all();
74
-        if($this->option('background')) {
74
+        if ($this->option('background')) {
75 75
             \Log::debug(self::BACKGROUND_MOD_MEX);
76 76
             $this->info(self::BACKGROUND_MOD_MEX);
77 77
             foreach ($calendars as $calendar)
78 78
                 $this->makeBackground($calendar);
79 79
             \Log::debug(self::BACKGROUND_COMPLETED_MEX);
80 80
             $this->info(self::BACKGROUND_COMPLETED_MEX);
81
-        }else
82
-            foreach($calendars as $calendar)
81
+        } else
82
+            foreach ($calendars as $calendar)
83 83
                 $this->makeForeground($calendar);
84 84
     }
85 85
 
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
     private function makeBackground(Company $company)
91 91
     {
92 92
         $event = $this->schedule->command('optimise:meetings '.$company->id)->withoutOverlapping();
93
-        if($event->isDue($this->laravel))
93
+        if ($event->isDue($this->laravel))
94 94
             $event->run($this->laravel);
95 95
     }
96 96
 
@@ -100,8 +100,8 @@  discard block
 block discarded – undo
100 100
      */
101 101
     private function makeForeground(Company $company)
102 102
     {
103
-        $this->info('Optimisation company '. $company->id.' started');
103
+        $this->info('Optimisation company '.$company->id.' started');
104 104
         (new Optimise($company))->optimise()->save();
105
-        $this->info('Optimisation '. $company->id.' completed');
105
+        $this->info('Optimisation '.$company->id.' completed');
106 106
     }
107 107
 }
Please login to merge, or discard this patch.
Braces   +14 added lines, -10 removed lines patch added patch discarded remove patch
@@ -62,10 +62,11 @@  discard block
 block discarded – undo
62 62
 
63 63
         //TODO try...catch with destruct
64 64
         $companyId = $this->argument('companyId');
65
-        if(is_numeric($companyId))
66
-            $this->makeForeground(Company::findOrFail($companyId));
67
-        else
68
-            $this->syncAll();
65
+        if(is_numeric($companyId)) {
66
+                    $this->makeForeground(Company::findOrFail($companyId));
67
+        } else {
68
+                    $this->syncAll();
69
+        }
69 70
     }
70 71
 
71 72
     private function syncAll()
@@ -74,13 +75,15 @@  discard block
 block discarded – undo
74 75
         if($this->option('background')) {
75 76
             \Log::debug(self::BACKGROUND_MOD_MEX);
76 77
             $this->info(self::BACKGROUND_MOD_MEX);
77
-            foreach ($calendars as $calendar)
78
-                $this->makeBackground($calendar);
78
+            foreach ($calendars as $calendar) {
79
+                            $this->makeBackground($calendar);
80
+            }
79 81
             \Log::debug(self::BACKGROUND_COMPLETED_MEX);
80 82
             $this->info(self::BACKGROUND_COMPLETED_MEX);
81
-        }else
82
-            foreach($calendars as $calendar)
83
+        } else {
84
+                    foreach($calendars as $calendar)
83 85
                 $this->makeForeground($calendar);
86
+        }
84 87
     }
85 88
 
86 89
     /**
@@ -90,8 +93,9 @@  discard block
 block discarded – undo
90 93
     private function makeBackground(Company $company)
91 94
     {
92 95
         $event = $this->schedule->command('optimise:meetings '.$company->id)->withoutOverlapping();
93
-        if($event->isDue($this->laravel))
94
-            $event->run($this->laravel);
96
+        if($event->isDue($this->laravel)) {
97
+                    $event->run($this->laravel);
98
+        }
95 99
     }
96 100
 
97 101
     /**
Please login to merge, or discard this patch.
app/Console/Commands/Optimise/OptimiseException.php 1 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: 07/12/15
6
- * Time: 21.24
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: 07/12/15
6
+     * Time: 21.24
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\Optimise;
21 21
 
Please login to merge, or discard this patch.
app/Company.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -48,14 +48,14 @@  discard block
 block discarded – undo
48 48
      *
49 49
      * @var array
50 50
      */
51
-    protected $fillable = ['name', 'email', 'password'];
51
+    protected $fillable = [ 'name', 'email', 'password' ];
52 52
 
53 53
     /**
54 54
      * The attributes excluded from the model's JSON form.
55 55
      *
56 56
      * @var array
57 57
      */
58
-    protected $hidden = ['password', 'remember_token'];
58
+    protected $hidden = [ 'password', 'remember_token' ];
59 59
 
60 60
     /**
61 61
      * @return \Illuminate\Database\Eloquent\Relations\HasMany
@@ -120,8 +120,8 @@  discard block
 block discarded – undo
120 120
             ->where('calendars.enabled', '=', '1')
121 121
             ->where('timeslots.time_start', '>=', $from)
122 122
             ->where('timeslots.time_end', '<=', $to)
123
-            ->where('employees.company_id','=', $this->id)
124
-            ->select('employees.id','timeslots.time_start','timeslots.time_end')
123
+            ->where('employees.company_id', '=', $this->id)
124
+            ->select('employees.id', 'timeslots.time_start', 'timeslots.time_end')
125 125
             ->get();
126 126
     }
127 127
 
@@ -137,9 +137,9 @@  discard block
 block discarded – undo
137 137
             ->join('meeting_timeslots', 'meetings.id', '=', 'meeting_timeslots.meeting_id')
138 138
             ->where('meeting_timeslots.time_start', '>=', $from)
139 139
             ->where('meeting_timeslots.time_end', '<=', $to)
140
-            ->where('groups.company_id','=', $this->id)
140
+            ->where('groups.company_id', '=', $this->id)
141 141
             //->where('meetings.start_time','=', 'NULL')
142
-            ->select('meetings.id', 'meetings.duration','meeting_timeslots.time_start','meeting_timeslots.time_end')
142
+            ->select('meetings.id', 'meetings.duration', 'meeting_timeslots.time_start', 'meeting_timeslots.time_end')
143 143
             ->get();
144 144
     }
145 145
 
@@ -151,8 +151,8 @@  discard block
 block discarded – undo
151 151
             ->join('employees', 'employee_group.employee_id', '=', 'employees.id')
152 152
             ->whereIn('employees.id', $users)
153 153
             ->whereIn('meetings.id', $meetings)
154
-            ->where('groups.company_id','=', $this->id) //this is not needed
155
-            ->where('employees.company_id','=', $this->id) //this is not needed
154
+            ->where('groups.company_id', '=', $this->id) //this is not needed
155
+            ->where('employees.company_id', '=', $this->id) //this is not needed
156 156
             ->select('employees.id as employee_id', 'meetings.id as meeting_id')
157 157
             ->get();
158 158
     }
Please login to merge, or discard this patch.
app/Events/Optimise/OkEvent.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,6 +39,6 @@
 block discarded – undo
39 39
      */
40 40
     public function broadcastOn()
41 41
     {
42
-        return [];
42
+        return [ ];
43 43
     }
44 44
 }
Please login to merge, or discard this patch.
app/Events/Optimise/ErrorEvent.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,6 +39,6 @@
 block discarded – undo
39 39
      */
40 40
     public function broadcastOn()
41 41
     {
42
-        return [];
42
+        return [ ];
43 43
     }
44 44
 }
Please login to merge, or discard this patch.