chore: cgl fixes

This commit is contained in:
2026-09-11 19:37:00 +02:00
parent 5f8a586385
commit 5b133f724d
26 changed files with 87 additions and 92 deletions
+8 -8
View File
@@ -69,7 +69,7 @@ class PriceTimelineBuilder
$lastDefault = null;
// Step 2: walk each segment [start, end) and resolve the effective price.
for ($i = 0, $count = count($boundaries) - 1; $i < $count; $i++) {
for ($i = 0, $count = count($boundaries) - 1; $i < $count; ++$i) {
$segStart = $boundaries[$i];
$segEndNext = $boundaries[$i + 1];
@@ -81,12 +81,12 @@ class PriceTimelineBuilder
$candidates = array_filter(
$prices,
fn($p) => $p->getDateFrom() <= $segStart && $p->getDateTo() >= $segStart,
fn ($p) => $p->getDateFrom() <= $segStart && $p->getDateTo() >= $segStart,
);
$winner = $this->resolveWinner($candidates);
if ($winner === null) {
if (null === $winner) {
// Gap: reset merge state so the next winner always opens a new row.
$lastWinner = null;
$lastDefault = null;
@@ -94,8 +94,8 @@ class PriceTimelineBuilder
}
$defaultWinner = null;
if ($winner->getType() === PriceType::DISCOUNT) {
$defaults = array_filter($candidates, fn($p) => $p->getType() === null);
if (PriceType::DISCOUNT === $winner->getType()) {
$defaults = array_filter($candidates, fn ($p) => null === $p->getType());
$defaultWinner = $this->resolveWinner($defaults);
}
@@ -125,8 +125,8 @@ class PriceTimelineBuilder
includedPax: $winner->getIncludedPax(),
pricePerNight: round($winner->getPricePerNight() / 100, 2),
priceAdditionalPerson: round($winner->getPriceAdditionalPerson() / 100, 2),
defaultPricePerNight: $defaultWinner !== null ? round($defaultWinner->getPricePerNight() / 100, 2) : null,
defaultPriceAdditionalPerson: $defaultWinner !== null ? round($defaultWinner->getPriceAdditionalPerson() / 100, 2) : null,
defaultPricePerNight: null !== $defaultWinner ? round($defaultWinner->getPricePerNight() / 100, 2) : null,
defaultPriceAdditionalPerson: null !== $defaultWinner ? round($defaultWinner->getPriceAdditionalPerson() / 100, 2) : null,
currency: $currency,
type: $winner->getType()?->value,
);
@@ -150,7 +150,7 @@ class PriceTimelineBuilder
{
$winner = null;
foreach ($candidates as $candidate) {
if ($winner === null) {
if (null === $winner) {
$winner = $candidate;
continue;
}