@@ -303,10 +303,10 @@ discard block |
||
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | /** |
| 306 | - * @param array $users |
|
| 307 | - * @param array $meetings |
|
| 306 | + * @param string[] $users |
|
| 307 | + * @param string[] $meetings |
|
| 308 | 308 | * @param \Illuminate\Support\Collection $usersMeetings |
| 309 | - * @return array |
|
| 309 | + * @return \string[] |
|
| 310 | 310 | */ |
| 311 | 311 | static private function getUsersMeetingsArray($users, $meetings, \Illuminate\Support\Collection $usersMeetings) |
| 312 | 312 | { |
@@ -338,8 +338,9 @@ discard block |
||
| 338 | 338 | |
| 339 | 339 | /** |
| 340 | 340 | * @param \Illuminate\Support\Collection $timeSlots |
| 341 | - * @param bool|true $free if true the array is filled with 1 for timeslots values else with 0 for timeslots values |
|
| 342 | - * @return array |
|
| 341 | + * @param boolean $free if true the array is filled with 1 for timeslots values else with 0 for timeslots values |
|
| 342 | + * @param integer $timeslotsN |
|
| 343 | + * @return \string[] |
|
| 343 | 344 | */ |
| 344 | 345 | static private function getAvailabilityArray(\Illuminate\Support\Collection $timeSlots, $timeslotsN, $free=true) |
| 345 | 346 | { |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | foreach($meetings as $meeting){ |
| 318 | 318 | if($usersMeetingsTmp->contains('meeting_id', $meeting)){ |
| 319 | 319 | $ret[$user][$meeting] = 1; |
| 320 | - }else{ |
|
| 320 | + } else{ |
|
| 321 | 321 | $ret[$user][$meeting] = 0; |
| 322 | 322 | } |
| 323 | 323 | } |
@@ -363,8 +363,9 @@ discard block |
||
| 363 | 363 | static private function fillTimeSlots(array $array, $id, \Illuminate\Support\Collection $timeSlots, $fill = '0') |
| 364 | 364 | { |
| 365 | 365 | foreach($timeSlots as $timeSlot) { |
| 366 | - if(!isset($array[$id])) |
|
| 367 | - $array[$id] = []; |
|
| 366 | + if(!isset($array[$id])) { |
|
| 367 | + $array[$id] = []; |
|
| 368 | + } |
|
| 368 | 369 | $array[$id] = self::arrayPadInterval($array[$id], $timeSlot->time_start, $timeSlot->time_end, $fill); |
| 369 | 370 | } |
| 370 | 371 | return $array; |
@@ -379,8 +380,9 @@ discard block |
||
| 379 | 380 | static private function fillRow(array $array, $id, $until, $fill = '0') |
| 380 | 381 | { |
| 381 | 382 | for($i = 1; $i <= $until; $i++){ |
| 382 | - if(!isset($array[$id][$i])) |
|
| 383 | - $array[$id][$i] = $fill; |
|
| 383 | + if(!isset($array[$id][$i])) { |
|
| 384 | + $array[$id][$i] = $fill; |
|
| 385 | + } |
|
| 384 | 386 | } |
| 385 | 387 | |
| 386 | 388 | return $array; |
@@ -395,8 +397,9 @@ discard block |
||
| 395 | 397 | */ |
| 396 | 398 | static private function arrayPadInterval(array $array, $from, $to, $pad = '0') |
| 397 | 399 | { |
| 398 | - for($i = $from; $i<$to; $i++) |
|
| 399 | - $array[$i] = $pad; |
|
| 400 | + for($i = $from; $i<$to; $i++) { |
|
| 401 | + $array[$i] = $pad; |
|
| 402 | + } |
|
| 400 | 403 | return $array; |
| 401 | 404 | } |
| 402 | 405 | |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | |
| 120 | 120 | /** |
| 121 | 121 | * remove a no empty dir |
| 122 | - * @param $dir |
|
| 122 | + * @param string $dir |
|
| 123 | 123 | * @return bool |
| 124 | 124 | */ |
| 125 | 125 | private static function delTree($dir) { |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | /** |
| 176 | - * @return \string[] |
|
| 176 | + * @return string[] |
|
| 177 | 177 | */ |
| 178 | 178 | public function getUsers() |
| 179 | 179 | { |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | /** |
| 194 | - * @return \string[] |
|
| 194 | + * @return string[] |
|
| 195 | 195 | */ |
| 196 | 196 | public function getMeetings() |
| 197 | 197 | { |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | /** |
| 256 | - * @return \string[] |
|
| 256 | + * @return string[] |
|
| 257 | 257 | */ |
| 258 | 258 | public function getMeetingsAvailability() |
| 259 | 259 | { |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | /** |
| 285 | - * @return \string[] |
|
| 285 | + * @return string[] |
|
| 286 | 286 | */ |
| 287 | 287 | public function getMeetingsDuration() |
| 288 | 288 | { |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | /** |
| 315 | - * @return \string[] |
|
| 315 | + * @return string[] |
|
| 316 | 316 | */ |
| 317 | 317 | public function getUsersAvailability() |
| 318 | 318 | { |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | /** |
| 345 | - * @return \string[] |
|
| 345 | + * @return string[] |
|
| 346 | 346 | */ |
| 347 | 347 | public function getUsersMeetings() |
| 348 | 348 | { |
@@ -419,7 +419,7 @@ discard block |
||
| 419 | 419 | |
| 420 | 420 | /** |
| 421 | 421 | * @param string $file |
| 422 | - * @param array $data |
|
| 422 | + * @param string[] $data |
|
| 423 | 423 | * @throws OptimiseException |
| 424 | 424 | */ |
| 425 | 425 | static private function writeCSVArrayNoKey($file, $data) |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | |
| 436 | 436 | /** |
| 437 | 437 | * @param string $file |
| 438 | - * @param array $data |
|
| 438 | + * @param string[] $data |
|
| 439 | 439 | * @param string $name |
| 440 | 440 | * @throws OptimiseException |
| 441 | 441 | */ |
@@ -452,7 +452,7 @@ discard block |
||
| 452 | 452 | |
| 453 | 453 | /** |
| 454 | 454 | * @param string $file |
| 455 | - * @param array $data |
|
| 455 | + * @param string[] $data |
|
| 456 | 456 | * @param string $name |
| 457 | 457 | * @throws OptimiseException |
| 458 | 458 | */ |
@@ -471,7 +471,7 @@ discard block |
||
| 471 | 471 | /** |
| 472 | 472 | * @param string $file |
| 473 | 473 | * @param array $data |
| 474 | - * @param array $heading |
|
| 474 | + * @param string[] $heading |
|
| 475 | 475 | * @param \Closure $writer |
| 476 | 476 | * @throws OptimiseException |
| 477 | 477 | */ |
@@ -682,7 +682,7 @@ discard block |
||
| 682 | 682 | } |
| 683 | 683 | |
| 684 | 684 | /** |
| 685 | - * @param $proprieties |
|
| 685 | + * @param string[] $proprieties |
|
| 686 | 686 | * @throws OptimiseException |
| 687 | 687 | */ |
| 688 | 688 | private function checkArrayProprieties($proprieties) |
@@ -693,7 +693,7 @@ discard block |
||
| 693 | 693 | } |
| 694 | 694 | |
| 695 | 695 | /** |
| 696 | - * @param $proprieties |
|
| 696 | + * @param string[] $proprieties |
|
| 697 | 697 | * @throws OptimiseException |
| 698 | 698 | */ |
| 699 | 699 | private function checkIntProprieties($proprieties) |
@@ -707,6 +707,8 @@ discard block |
||
| 707 | 707 | * implementation of arraypad that doesn't change original keys<br/> |
| 708 | 708 | * <strong>CAUTION: Only positive $len</strong> |
| 709 | 709 | * @param array $array |
| 710 | + * @param integer $len |
|
| 711 | + * @param integer $pad |
|
| 710 | 712 | * @return array |
| 711 | 713 | */ |
| 712 | 714 | static private function arrayPad(array $array, $len, $pad) |
@@ -104,8 +104,9 @@ discard block |
||
| 104 | 104 | */ |
| 105 | 105 | function __destruct() |
| 106 | 106 | { |
| 107 | - if ($this->path && is_dir($this->path) && !self::delTree($this->path)) |
|
| 108 | - throw new OptimiseException('problems during removing of path directory'); |
|
| 107 | + if ($this->path && is_dir($this->path) && !self::delTree($this->path)) { |
|
| 108 | + throw new OptimiseException('problems during removing of path directory'); |
|
| 109 | + } |
|
| 109 | 110 | } |
| 110 | 111 | |
| 111 | 112 | /** |
@@ -113,8 +114,9 @@ discard block |
||
| 113 | 114 | */ |
| 114 | 115 | static private function checkGlpsol() |
| 115 | 116 | { |
| 116 | - if(!(`which glpsol`)) |
|
| 117 | - throw new OptimiseException('glpsol is not installed'); |
|
| 117 | + if(!(`which glpsol`)) { |
|
| 118 | + throw new OptimiseException('glpsol is not installed'); |
|
| 119 | + } |
|
| 118 | 120 | } |
| 119 | 121 | |
| 120 | 122 | /** |
@@ -138,12 +140,16 @@ discard block |
||
| 138 | 140 | { |
| 139 | 141 | $this->path = tempnam(sys_get_temp_dir(), 'OPT'); //TODO check the return in case of errors this return false on failure |
| 140 | 142 | unlink($this->path); //remove file to create a dir |
| 141 | - if(file_exists($this->path)) |
|
| 142 | - throw new OptimiseException('problem during creation of tmp dir (the directory already exists)'); |
|
| 143 | - if(!@mkdir($this->path)) |
|
| 144 | - throw new OptimiseException('problem during creation of tmp dir (mkdir problem)');; |
|
| 145 | - if(! is_dir($this->path)) |
|
| 146 | - throw new OptimiseException('problem during creation of tmp dir (it is not possible to create directory)'); |
|
| 143 | + if(file_exists($this->path)) { |
|
| 144 | + throw new OptimiseException('problem during creation of tmp dir (the directory already exists)'); |
|
| 145 | + } |
|
| 146 | + if(!@mkdir($this->path)) { |
|
| 147 | + throw new OptimiseException('problem during creation of tmp dir (mkdir problem)'); |
|
| 148 | + } |
|
| 149 | + ; |
|
| 150 | + if(! is_dir($this->path)) { |
|
| 151 | + throw new OptimiseException('problem during creation of tmp dir (it is not possible to create directory)'); |
|
| 152 | + } |
|
| 147 | 153 | } |
| 148 | 154 | |
| 149 | 155 | /** |
@@ -223,8 +229,9 @@ discard block |
||
| 223 | 229 | */ |
| 224 | 230 | public function setTimeSlots($timeSlots) |
| 225 | 231 | { |
| 226 | - if(!is_int($timeSlots) || $timeSlots <=0) |
|
| 227 | - throw new OptimiseException('$timeSlots is not integer or it is not >0'); |
|
| 232 | + if(!is_int($timeSlots) || $timeSlots <=0) { |
|
| 233 | + throw new OptimiseException('$timeSlots is not integer or it is not >0'); |
|
| 234 | + } |
|
| 228 | 235 | |
| 229 | 236 | $this->timeSlots = $timeSlots; |
| 230 | 237 | return $this; |
@@ -245,8 +252,9 @@ discard block |
||
| 245 | 252 | */ |
| 246 | 253 | public function setMaxTimeSlots($maxTimeSlots) |
| 247 | 254 | { |
| 248 | - if(!is_int($maxTimeSlots) || $maxTimeSlots <=0) |
|
| 249 | - throw new OptimiseException('$maxTimeSlots is not integer or it is not >0'); |
|
| 255 | + if(!is_int($maxTimeSlots) || $maxTimeSlots <=0) { |
|
| 256 | + throw new OptimiseException('$maxTimeSlots is not integer or it is not >0'); |
|
| 257 | + } |
|
| 250 | 258 | |
| 251 | 259 | $this->maxTimeSlots = $maxTimeSlots; |
| 252 | 260 | return $this; |
@@ -268,12 +276,14 @@ discard block |
||
| 268 | 276 | public function setMeetingsAvailability($meetingsAvailability) |
| 269 | 277 | { |
| 270 | 278 | $meetings = array_keys($meetingsAvailability); |
| 271 | - if(array_diff($meetings, $this->meetings)) |
|
| 272 | - throw new OptimiseException('meetings different from meetings set'); |
|
| 279 | + if(array_diff($meetings, $this->meetings)) { |
|
| 280 | + throw new OptimiseException('meetings different from meetings set'); |
|
| 281 | + } |
|
| 273 | 282 | foreach($meetingsAvailability as $key=>$meetingsAvailabilityS) { |
| 274 | 283 | $timeSlots = array_keys($meetingsAvailabilityS); |
| 275 | - if(count($timeSlots) != $this->timeSlots) |
|
| 276 | - throw new OptimiseException('timeSlots different from timeSlots set'); |
|
| 284 | + if(count($timeSlots) != $this->timeSlots) { |
|
| 285 | + throw new OptimiseException('timeSlots different from timeSlots set'); |
|
| 286 | + } |
|
| 277 | 287 | $meetingsAvailability[$key] = self::arrayPad($meetingsAvailabilityS, $this->timeSlots + $this->maxTimeSlots, 0); |
| 278 | 288 | } |
| 279 | 289 | |
@@ -303,8 +313,9 @@ discard block |
||
| 303 | 313 | } |
| 304 | 314 | foreach($meetingsDuration as $duration) { |
| 305 | 315 | $duration = (int) $duration; //TODO fix this (fix for optimise) |
| 306 | - if(!is_int($duration) || $duration <=0) |
|
| 307 | - throw new OptimiseException('duration is not integer or it is not >0'); |
|
| 316 | + if(!is_int($duration) || $duration <=0) { |
|
| 317 | + throw new OptimiseException('duration is not integer or it is not >0'); |
|
| 318 | + } |
|
| 308 | 319 | } |
| 309 | 320 | |
| 310 | 321 | $this->meetingsDuration = $meetingsDuration; |
@@ -327,12 +338,14 @@ discard block |
||
| 327 | 338 | public function setUsersAvailability($usersAvailability) |
| 328 | 339 | { |
| 329 | 340 | $users = array_keys($usersAvailability); |
| 330 | - if(array_diff($users, $this->users)) |
|
| 331 | - throw new OptimiseException('users different from users set'); |
|
| 341 | + if(array_diff($users, $this->users)) { |
|
| 342 | + throw new OptimiseException('users different from users set'); |
|
| 343 | + } |
|
| 332 | 344 | foreach($usersAvailability as $key=>$usersAvailabilityS) { |
| 333 | 345 | $timeSlots = array_keys($usersAvailabilityS); |
| 334 | - if(count($timeSlots) != $this->timeSlots) |
|
| 335 | - throw new OptimiseException('timeSlots different from timeSlots set'); |
|
| 346 | + if(count($timeSlots) != $this->timeSlots) { |
|
| 347 | + throw new OptimiseException('timeSlots different from timeSlots set'); |
|
| 348 | + } |
|
| 336 | 349 | |
| 337 | 350 | $usersAvailability[$key] = self::arrayPad($usersAvailabilityS, $this->timeSlots + $this->maxTimeSlots, 0); |
| 338 | 351 | } |
@@ -357,12 +370,14 @@ discard block |
||
| 357 | 370 | public function setUsersMeetings($usersMeetings) |
| 358 | 371 | { |
| 359 | 372 | $users = array_keys($usersMeetings); |
| 360 | - if(array_diff($users, $this->users)) |
|
| 361 | - throw new OptimiseException('users different from users set'); |
|
| 373 | + if(array_diff($users, $this->users)) { |
|
| 374 | + throw new OptimiseException('users different from users set'); |
|
| 375 | + } |
|
| 362 | 376 | foreach($usersMeetings as $usersMeetingsS) { |
| 363 | 377 | $meetings = array_keys($usersMeetingsS); |
| 364 | - if(array_diff($meetings, $this->meetings)) |
|
| 365 | - throw new OptimiseException('meetings different from meetings set'); |
|
| 378 | + if(array_diff($meetings, $this->meetings)) { |
|
| 379 | + throw new OptimiseException('meetings different from meetings set'); |
|
| 380 | + } |
|
| 366 | 381 | } |
| 367 | 382 | |
| 368 | 383 | $this->usersMeetings = $usersMeetings; |
@@ -460,8 +475,9 @@ discard block |
||
| 460 | 475 | { |
| 461 | 476 | $f = function ($fp, $data){ |
| 462 | 477 | foreach ($data as $key=>$field) { |
| 463 | - foreach ($field as $key2=>$field2) |
|
| 464 | - fputcsv($fp, [$key, $key2, $field2]); |
|
| 478 | + foreach ($field as $key2=>$field2) { |
|
| 479 | + fputcsv($fp, [$key, $key2, $field2]); |
|
| 480 | + } |
|
| 465 | 481 | } |
| 466 | 482 | }; |
| 467 | 483 | |
@@ -478,8 +494,9 @@ discard block |
||
| 478 | 494 | static private function writeCSV($file, $data, $heading, \Closure $writer) |
| 479 | 495 | { |
| 480 | 496 | $fp = @fopen($file, 'w'); |
| 481 | - if(!$fp) |
|
| 482 | - throw new OptimiseException('problem during creation of a file'); |
|
| 497 | + if(!$fp) { |
|
| 498 | + throw new OptimiseException('problem during creation of a file'); |
|
| 499 | + } |
|
| 483 | 500 | |
| 484 | 501 | fputcsv($fp, $heading); |
| 485 | 502 | |
@@ -499,8 +516,9 @@ discard block |
||
| 499 | 516 | $this->writeData(); |
| 500 | 517 | $this->writeModelFile(); |
| 501 | 518 | $event = $this->schedule->exec('glpsol --math '.$this->getModelPath())->sendOutputTo($this->getOutputPath())->after(function () { }); //this just to execute in foreground |
| 502 | - if($event->isDue($this->laravel)) |
|
| 503 | - $event->run($this->laravel); |
|
| 519 | + if($event->isDue($this->laravel)) { |
|
| 520 | + $event->run($this->laravel); |
|
| 521 | + } |
|
| 504 | 522 | //TODO catch glpsol errors |
| 505 | 523 | return $this; |
| 506 | 524 | } |
@@ -513,8 +531,9 @@ discard block |
||
| 513 | 531 | $strReplaceS = array('{USERS_PATH}', '{MEETINGS_PATH}', '{USER_AVAILABILITY_PATH}', '{MEETINGS_AVAILABILITY_PATH}', '{USER_MEETINGS_PATH}', '{MEETINGS_DURATION_PATH}', '{TIME_SLOTS}', '{MAX_TIME_SLOTS}', '{X_OUT_PATH}', '{Y_OUT_PATH}'); |
| 514 | 532 | $strReplaceR = array($this->getUsersPath(), $this->getMeetingsPath(), $this->getUsersAvailabilityPath(), $this->getMeetingsAvailabilityPath(), $this->getUsersMeetingsPath(), $this->getMeetingsDurationPath(), $this->timeSlots, $this->maxTimeSlots, $this->getXPath(), $this->getYPath()); |
| 515 | 533 | $f = @fopen($this->getModelPath(), "w"); |
| 516 | - if(!$f) |
|
| 517 | - throw new OptimiseException('problem during creation of a file'); |
|
| 534 | + if(!$f) { |
|
| 535 | + throw new OptimiseException('problem during creation of a file'); |
|
| 536 | + } |
|
| 518 | 537 | fwrite($f, str_replace($strReplaceS, $strReplaceR, file_get_contents(__DIR__ . "/model.stub"))); |
| 519 | 538 | fclose($f); |
| 520 | 539 | } |
@@ -543,8 +562,9 @@ discard block |
||
| 543 | 562 | */ |
| 544 | 563 | public function getOutput() |
| 545 | 564 | { |
| 546 | - if(!($data = file_get_contents($this->getOutputPath()))) |
|
| 547 | - throw new OptimiseException('problems during reading the file'); |
|
| 565 | + if(!($data = file_get_contents($this->getOutputPath()))) { |
|
| 566 | + throw new OptimiseException('problems during reading the file'); |
|
| 567 | + } |
|
| 548 | 568 | return $data; |
| 549 | 569 | } |
| 550 | 570 | |
@@ -555,12 +575,14 @@ discard block |
||
| 555 | 575 | */ |
| 556 | 576 | static private function readCSVFile($file) |
| 557 | 577 | { |
| 558 | - if(!file_exists($file) || !filesize($file)) |
|
| 559 | - throw new OptimiseException('no results file'); |
|
| 578 | + if(!file_exists($file) || !filesize($file)) { |
|
| 579 | + throw new OptimiseException('no results file'); |
|
| 580 | + } |
|
| 560 | 581 | |
| 561 | 582 | $handle = @fopen($file,"r"); |
| 562 | - if(!$handle) |
|
| 563 | - throw new OptimiseException('problems during reading the file'); |
|
| 583 | + if(!$handle) { |
|
| 584 | + throw new OptimiseException('problems during reading the file'); |
|
| 585 | + } |
|
| 564 | 586 | |
| 565 | 587 | $ret = []; |
| 566 | 588 | fgetcsv($handle); //skip head |
@@ -687,9 +709,10 @@ discard block |
||
| 687 | 709 | */ |
| 688 | 710 | private function checkArrayProprieties($proprieties) |
| 689 | 711 | { |
| 690 | - foreach($proprieties as $propriety) |
|
| 691 | - if(count($this->$propriety)==0) |
|
| 712 | + foreach($proprieties as $propriety) { |
|
| 713 | + if(count($this->$propriety)==0) |
|
| 692 | 714 | throw new OptimiseException($propriety.' is not set correctly'); |
| 715 | + } |
|
| 693 | 716 | } |
| 694 | 717 | |
| 695 | 718 | /** |
@@ -698,9 +721,10 @@ discard block |
||
| 698 | 721 | */ |
| 699 | 722 | private function checkIntProprieties($proprieties) |
| 700 | 723 | { |
| 701 | - foreach($proprieties as $propriety) |
|
| 702 | - if(!is_int($this->$propriety) || $this->$propriety <= 0) |
|
| 724 | + foreach($proprieties as $propriety) { |
|
| 725 | + if(!is_int($this->$propriety) || $this->$propriety <= 0) |
|
| 703 | 726 | throw new OptimiseException($propriety.' is not set correctly'); |
| 727 | + } |
|
| 704 | 728 | } |
| 705 | 729 | |
| 706 | 730 | /** |
@@ -712,8 +736,9 @@ discard block |
||
| 712 | 736 | static private function arrayPad(array $array, $len, $pad) |
| 713 | 737 | { |
| 714 | 738 | $len = $len - count($array); |
| 715 | - for($i = 0; $i<$len; $i++) |
|
| 716 | - $array[] = $pad; |
|
| 739 | + for($i = 0; $i<$len; $i++) { |
|
| 740 | + $array[] = $pad; |
|
| 741 | + } |
|
| 717 | 742 | return $array; |
| 718 | 743 | } |
| 719 | 744 | } |
| 720 | 745 | \ No newline at end of file |
@@ -62,10 +62,11 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 | /** |