Completed
Push — master ( ea593a...141751 )
by claudio
07:51
created
app/Console/Commands/Optimise/OptimiseCommand.php 1 patch
Braces   +15 added lines, -11 removed lines patch added patch discarded remove patch
@@ -58,10 +58,11 @@  discard block
 block discarded – undo
58 58
         //TODO insert a timeout
59 59
         //TODO try...catch with destruct
60 60
         $companyId = $this->argument('companyId');
61
-        if (is_numeric($companyId))
62
-            $this->makeForeground(Company::findOrFail($companyId));
63
-        else
64
-            $this->syncAll();
61
+        if (is_numeric($companyId)) {
62
+                    $this->makeForeground(Company::findOrFail($companyId));
63
+        } else {
64
+                    $this->syncAll();
65
+        }
65 66
     }
66 67
 
67 68
     /**
@@ -74,7 +75,7 @@  discard block
 block discarded – undo
74 75
         try {
75 76
             (new Optimise($company, $this->schedule, $this->laravel))->optimise()->save();
76 77
             $this->info('Optimisation ' . $company->id . ' completed');
77
-        }catch(OptimiseException $e) {
78
+        } catch(OptimiseException $e) {
78 79
             if ($e->isEmpty()) {
79 80
                 $mex = 'Company ' . $company->id . ' doesn\'t have sufficient data';
80 81
                 $this->warn($mex);
@@ -94,13 +95,15 @@  discard block
 block discarded – undo
94 95
         if ($this->option('background')) {
95 96
             \Log::debug(self::BACKGROUND_MOD_MEX);
96 97
             $this->info(self::BACKGROUND_MOD_MEX);
97
-            foreach ($companies as $company)
98
-                $this->makeBackground($company);
98
+            foreach ($companies as $company) {
99
+                            $this->makeBackground($company);
100
+            }
99 101
             \Log::debug(self::BACKGROUND_COMPLETED_MEX);
100 102
             $this->info(self::BACKGROUND_COMPLETED_MEX);
101
-        } else
102
-            foreach ($companies as $company)
103
+        } else {
104
+                    foreach ($companies as $company)
103 105
                 $this->makeForeground($company);
106
+        }
104 107
     }
105 108
 
106 109
     /**
@@ -110,7 +113,8 @@  discard block
 block discarded – undo
110 113
     private function makeBackground(Company $company)
111 114
     {
112 115
         $event = $this->schedule->command('optimise:meetings ' . $company->id)->withoutOverlapping();
113
-        if ($event->isDue($this->laravel))
114
-            $event->run($this->laravel);
116
+        if ($event->isDue($this->laravel)) {
117
+                    $event->run($this->laravel);
118
+        }
115 119
     }
116 120
 }
Please login to merge, or discard this patch.