chore: cgl cleanup
This commit is contained in:
@@ -193,6 +193,7 @@ class BpnXmlSyncCommand extends Command
|
||||
|
||||
/**
|
||||
* @return array<string, int>
|
||||
*
|
||||
* @throws FilesystemException
|
||||
*/
|
||||
private function syncFiles(SymfonyStyle $io): array
|
||||
|
||||
@@ -14,9 +14,9 @@ use App\Form\PersonalDataType;
|
||||
use App\Repository\NewsletterOptInConfirmationRepository;
|
||||
use App\Security\Crypt;
|
||||
use App\Service\BookingEditDataLoader;
|
||||
use App\Service\ProfileCompletenessChecker;
|
||||
use App\Service\MailjetApiClient;
|
||||
use App\Service\NewsletterManager;
|
||||
use App\Service\ProfileCompletenessChecker;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
|
||||
@@ -182,8 +182,7 @@ class Step4Controller extends AbstractController
|
||||
FormInterface $form,
|
||||
bool $newsletterOptInVisible,
|
||||
?string $newsletterTargetEmail,
|
||||
): Response
|
||||
{
|
||||
): Response {
|
||||
$bookingCreateContext = $this->createContextFactory->createWithParticipantPrices($bookingCreateDto);
|
||||
|
||||
return $this->render('booking/create/step_4.html.twig', [
|
||||
|
||||
@@ -86,6 +86,7 @@ class Mailer
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $options
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
private function resolveConfig(array $options): array
|
||||
|
||||
@@ -22,8 +22,8 @@ use App\Form\Service\Condition\RentalSelectionCondition;
|
||||
use App\Form\Service\Condition\RoomSelectionCondition;
|
||||
use App\Form\Service\Condition\ServiceSubTypeCondition;
|
||||
use App\Form\Service\Condition\SkiPassSelectionCondition;
|
||||
use App\Form\Service\Condition\TravelStartCutoffReachedCondition;
|
||||
use App\Form\Service\Condition\TransportationServicesMutabilityCondition;
|
||||
use App\Form\Service\Condition\TravelStartCutoffReachedCondition;
|
||||
|
||||
/**
|
||||
* Field state provider for the booking edit workflow.
|
||||
|
||||
@@ -16,8 +16,8 @@ use App\Form\Model\RoomSelectionDto;
|
||||
use App\Form\Service\Abstract\AbstractFieldOptionsProvider;
|
||||
use App\Service\BookingPriceCalculator;
|
||||
use App\Service\InsuranceManager;
|
||||
use App\Service\ServiceLabelFormatter;
|
||||
use App\Service\ServiceAvailabilityCalculator;
|
||||
use App\Service\ServiceLabelFormatter;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
/**
|
||||
|
||||
@@ -223,7 +223,7 @@ class ParticipantRentalsFieldHandler extends AbstractParticipantFieldHandler
|
||||
* - rental.dateTo === skipass.dateTo
|
||||
*
|
||||
* @param array $rentals All available rental services
|
||||
* @param \App\Form\Model\ParticipantDto $participant The participant with skipass selection
|
||||
* @param ParticipantDto $participant The participant with skipass selection
|
||||
*
|
||||
* @return array Filtered rentals matching the skipass duration
|
||||
*/
|
||||
|
||||
@@ -13,8 +13,8 @@ use App\BusProNet\XmlLoader\AgencyLoader;
|
||||
use App\Exception\NoRoomsAvailableException;
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Form\Model\ParticipantDto;
|
||||
use App\Form\Service\ServiceAgeEvaluator;
|
||||
use App\Form\Model\RoomSelectionDto;
|
||||
use App\Form\Service\ServiceAgeEvaluator;
|
||||
use Symfony\Component\DependencyInjection\Attribute\Autowire;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
@@ -539,8 +539,7 @@ class BookingConfigurator
|
||||
BookingDto $bookingDto,
|
||||
int $participantIndex,
|
||||
ServiceAgeEvaluator $ageEvaluator,
|
||||
): bool
|
||||
{
|
||||
): bool {
|
||||
if (false === $ageEvaluator->canEvaluate($service)) {
|
||||
return true;
|
||||
}
|
||||
@@ -640,5 +639,4 @@ class BookingConfigurator
|
||||
|
||||
$bookingDto->bookingStatus = $this->bookingStatusRuleRegistry->evaluateStatus($bookingDto);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,8 +25,7 @@ class BookingCreateContextFactory
|
||||
public function create(
|
||||
BookingDto $bookingDto,
|
||||
string $pricingMode = RoomPricingCalculator::PRICING_MODE_ASSIGNMENT,
|
||||
): BookingCreateContext
|
||||
{
|
||||
): BookingCreateContext {
|
||||
$baseContext = $this->buildBaseContext($bookingDto, $pricingMode);
|
||||
|
||||
return new BookingCreateContext(
|
||||
|
||||
@@ -7,8 +7,8 @@ namespace App\Service;
|
||||
use App\BusProNet\Model\Booking;
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Form\Model\BookingEditContext;
|
||||
use App\Form\Model\BookingSummaryDto;
|
||||
use App\Form\Model\BookingMutabilityDto;
|
||||
use App\Form\Model\BookingSummaryDto;
|
||||
|
||||
/**
|
||||
* Prepares the shared booking edit flow context.
|
||||
|
||||
@@ -241,6 +241,7 @@ class BookingPricingAssembler
|
||||
* Groups services by their subtypes for display, separating positive costs and discounts.
|
||||
*
|
||||
* @param array<string, array<string, mixed>> $serviceAggregation
|
||||
*
|
||||
* @return array<int, array<string, mixed>>
|
||||
*/
|
||||
private function groupServicesBySubtype(array $serviceAggregation): array
|
||||
@@ -387,6 +388,7 @@ class BookingPricingAssembler
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $serviceData
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
private function createServicePricingLineItem(array $serviceData): array
|
||||
|
||||
@@ -42,8 +42,7 @@ class BookingSummaryAssembler
|
||||
public function getSummaryData(
|
||||
BookingDto $bookingDto,
|
||||
string $roomPricingMode = RoomPricingCalculator::PRICING_MODE_ASSIGNMENT,
|
||||
): BookingSummaryDto
|
||||
{
|
||||
): BookingSummaryDto {
|
||||
// Get selected rooms (for Step1 controller compatibility)
|
||||
$selectedRooms = $bookingDto->getSelectedRooms();
|
||||
|
||||
|
||||
@@ -161,8 +161,6 @@ class BpnXmlAnonymizer
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $personId
|
||||
*
|
||||
* @return array{firstName: string, lastName: string, street: string, postalCode: string, city: string, email: string, mobilePhone: string}
|
||||
*/
|
||||
private function getOrCreateIdentity(string $personId): array
|
||||
|
||||
@@ -157,19 +157,13 @@ class MailjetApiClient
|
||||
|
||||
$payload = $response->toArray(false);
|
||||
if ($statusCode >= 400) {
|
||||
$payloadSummary = is_array($payload)
|
||||
? json_encode($payload, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE)
|
||||
: null;
|
||||
$payloadSummary = json_encode($payload, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
|
||||
$payloadSummary = false === $payloadSummary ? null : $payloadSummary;
|
||||
|
||||
throw new NewsletterProviderException(sprintf(
|
||||
'Mailjet request failed with status %d for resource %s%s',
|
||||
$statusCode,
|
||||
$resource,
|
||||
null !== $payloadSummary ? sprintf(' (%s)', $payloadSummary) : ''
|
||||
));
|
||||
throw new NewsletterProviderException(sprintf('Mailjet request failed with status %d for resource %s%s', $statusCode, $resource, null !== $payloadSummary ? sprintf(' (%s)', $payloadSummary) : ''));
|
||||
}
|
||||
|
||||
return is_array($payload) ? $payload : [];
|
||||
return $payload;
|
||||
} catch (\Throwable $exception) {
|
||||
if ($allow404 && str_contains($exception->getMessage(), '404')) {
|
||||
return [];
|
||||
@@ -179,10 +173,7 @@ class MailjetApiClient
|
||||
throw $exception;
|
||||
}
|
||||
|
||||
throw new NewsletterProviderException(
|
||||
sprintf('Mailjet request error for resource %s', $resource),
|
||||
previous: $exception
|
||||
);
|
||||
throw new NewsletterProviderException(sprintf('Mailjet request error for resource %s', $resource), previous: $exception);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@ declare(strict_types=1);
|
||||
namespace App\Service;
|
||||
|
||||
use App\Email\Mailer;
|
||||
use App\Exception\NewsletterProviderException;
|
||||
use App\Entity\NewsletterOptInConfirmation;
|
||||
use App\Exception\NewsletterProviderException;
|
||||
use App\Model\NewsletterConfirmationResult;
|
||||
use App\Repository\NewsletterOptInConfirmationRepository;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
@@ -26,8 +26,6 @@ class ParticipantCardAssembler
|
||||
|
||||
/**
|
||||
* Get card data for a single participant.
|
||||
*
|
||||
* @return ParticipantCardDataDto
|
||||
*/
|
||||
public function getCardData(BookingDto $bookingDto, int $index): ParticipantCardDataDto
|
||||
{
|
||||
@@ -124,8 +122,6 @@ class ParticipantCardAssembler
|
||||
*
|
||||
* Returns a dash marker when the price is zero and no room is assigned,
|
||||
* indicating incomplete configuration rather than a zero-cost booking.
|
||||
*
|
||||
* @return ParticipantCardPriceDto
|
||||
*/
|
||||
private function getPriceData(BookingDto $bookingDto, int $index): ParticipantCardPriceDto
|
||||
{
|
||||
@@ -169,8 +165,6 @@ class ParticipantCardAssembler
|
||||
|
||||
/**
|
||||
* Get card data for a single participant with validation state.
|
||||
*
|
||||
* @return ParticipantCardDataDto
|
||||
*/
|
||||
public function getCardDataWithValidation(BookingDto $bookingDto, int $index): ParticipantCardDataDto
|
||||
{
|
||||
|
||||
@@ -28,8 +28,7 @@ class RoomPricingCalculator
|
||||
public function calculateRoomPricing(
|
||||
BookingDto $bookingDto,
|
||||
string $pricingMode = self::PRICING_MODE_ASSIGNMENT,
|
||||
): array
|
||||
{
|
||||
): array {
|
||||
// In edit mode, use room data from the booking entity
|
||||
if (BookingDto::MODE_EDIT === $bookingDto->getMode() && null !== $bookingDto->booking) {
|
||||
return $this->calculateRoomPricingFromBooking($bookingDto);
|
||||
@@ -45,8 +44,7 @@ class RoomPricingCalculator
|
||||
public function calculateRoomTotal(
|
||||
BookingDto $bookingDto,
|
||||
string $pricingMode = self::PRICING_MODE_ASSIGNMENT,
|
||||
): float
|
||||
{
|
||||
): float {
|
||||
$roomPricing = $this->calculateRoomPricing($bookingDto, $pricingMode);
|
||||
|
||||
return array_sum(array_column($roomPricing, 'totalPrice'));
|
||||
|
||||
@@ -40,7 +40,7 @@ final class ServiceLabelFormatter
|
||||
return $fallbackLabel;
|
||||
}
|
||||
|
||||
if (!($service instanceof Service)) {
|
||||
if (!$service instanceof Service) {
|
||||
return $fallbackLabel;
|
||||
}
|
||||
|
||||
|
||||
@@ -162,14 +162,16 @@ class TravelSnapshotManager
|
||||
|
||||
/**
|
||||
* Refreshes snapshot payloads with extended availability data.
|
||||
*
|
||||
* @param array<int>|null $xmlAvailableDateIds
|
||||
*
|
||||
* @return array{processed:int,updated:int,failed:int}
|
||||
*/
|
||||
public function refreshExtendedSnapshots(
|
||||
int $limit = 500,
|
||||
bool $force = false,
|
||||
int $refreshAfterMinutes = 360,
|
||||
?array $xmlAvailableDateIds = null
|
||||
?array $xmlAvailableDateIds = null,
|
||||
): array {
|
||||
$dateToThreshold = new \DateTimeImmutable('today');
|
||||
$refreshBefore = new \DateTimeImmutable(sprintf('-%d minutes', $refreshAfterMinutes));
|
||||
|
||||
@@ -14,7 +14,6 @@ use App\Model\DomainConfig;
|
||||
use App\Service\ParticipantEligibilityChecker;
|
||||
use Symfony\Component\Form\FormView;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Twig\Environment;
|
||||
use Twig\Extension\RuntimeExtensionInterface;
|
||||
use Twig\Extra\Intl\IntlExtension;
|
||||
|
||||
|
||||
@@ -22,4 +22,3 @@ class MandatoryAdditionalServicesSelected extends Constraint
|
||||
return static::CLASS_CONSTRAINT;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -83,4 +83,3 @@ class MandatoryAdditionalServicesSelectedValidator extends ConstraintValidator
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -427,7 +427,7 @@ class BookingEditSubmitterTest extends TestCase
|
||||
?BookingEditDraftManager $draftService = null,
|
||||
?TravelDataProvider $travelDataService = null,
|
||||
?BookingEditSubmitGuard $submitGuard = null,
|
||||
?BookingSessionStore $bookingSessionService = null,
|
||||
?BookingSessionManager $bookingSessionService = null,
|
||||
): BookingEditSubmitter {
|
||||
return new BookingEditSubmitter(
|
||||
$apiClient ?? $this->createMock(\App\BusProNet\ApiClient::class),
|
||||
|
||||
Reference in New Issue
Block a user