mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-24 23:55:02 +00:00
apply more cs rules for php-cs
This commit is contained in:
@@ -18,9 +18,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\CalendarBundle\Service\ShortMessageNotification;
|
||||
|
||||
use DateInterval;
|
||||
use Monolog\DateTimeImmutable;
|
||||
use UnexpectedValueException;
|
||||
|
||||
/**
|
||||
* * Lundi => Envoi des rdv du mardi et mercredi.
|
||||
@@ -33,7 +31,7 @@ class DefaultRangeGenerator implements RangeGeneratorInterface
|
||||
{
|
||||
public function generateRange(\DateTimeImmutable $date): ?array
|
||||
{
|
||||
$onMidnight = DateTimeImmutable::createFromFormat('Y-m-d H:i:s', $date->format('Y-m-d') . ' 00:00:00');
|
||||
$onMidnight = DateTimeImmutable::createFromFormat('Y-m-d H:i:s', $date->format('Y-m-d').' 00:00:00');
|
||||
|
||||
switch ($dow = (int) $onMidnight->format('w')) {
|
||||
case 6: // Saturday
|
||||
@@ -42,32 +40,32 @@ class DefaultRangeGenerator implements RangeGeneratorInterface
|
||||
|
||||
case 1: // Monday
|
||||
// send for Tuesday and Wednesday
|
||||
$startDate = $onMidnight->add(new DateInterval('P1D'));
|
||||
$endDate = $startDate->add(new DateInterval('P2D'));
|
||||
$startDate = $onMidnight->add(new \DateInterval('P1D'));
|
||||
$endDate = $startDate->add(new \DateInterval('P2D'));
|
||||
|
||||
break;
|
||||
|
||||
case 2: // tuesday
|
||||
case 3: // wednesday
|
||||
$startDate = $onMidnight->add(new DateInterval('P2D'));
|
||||
$endDate = $startDate->add(new DateInterval('P1D'));
|
||||
$startDate = $onMidnight->add(new \DateInterval('P2D'));
|
||||
$endDate = $startDate->add(new \DateInterval('P1D'));
|
||||
|
||||
break;
|
||||
|
||||
case 4: // thursday
|
||||
$startDate = $onMidnight->add(new DateInterval('P2D'));
|
||||
$endDate = $startDate->add(new DateInterval('P2D'));
|
||||
$startDate = $onMidnight->add(new \DateInterval('P2D'));
|
||||
$endDate = $startDate->add(new \DateInterval('P2D'));
|
||||
|
||||
break;
|
||||
|
||||
case 5: // friday
|
||||
$startDate = $onMidnight->add(new DateInterval('P3D'));
|
||||
$endDate = $startDate->add(new DateInterval('P1D'));
|
||||
$startDate = $onMidnight->add(new \DateInterval('P3D'));
|
||||
$endDate = $startDate->add(new \DateInterval('P1D'));
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new UnexpectedValueException('a day of a week should not have the value: ' . $dow);
|
||||
throw new \UnexpectedValueException('a day of a week should not have the value: '.$dow);
|
||||
}
|
||||
|
||||
return ['startDate' => $startDate, 'endDate' => $endDate];
|
||||
|
Reference in New Issue
Block a user