chore: cleanup
This commit is contained in:
@@ -151,56 +151,4 @@ class ParticipantSkiPassFieldHandler extends AbstractParticipantFieldHandler
|
||||
|
||||
return true; // Service passed both age and date validation
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds a selected skipass in the list of available skipasses.
|
||||
*
|
||||
* @param mixed $selectedService The selected skipass to find
|
||||
* @param array $availableServices Array of available Service objects
|
||||
*
|
||||
* @return Service|null The found service or null if not found
|
||||
*/
|
||||
private function findServiceInAvailableServices(mixed $selectedService, array $availableServices): ?Service
|
||||
{
|
||||
foreach ($availableServices as $availableService) {
|
||||
if ($this->servicesMatch($selectedService, $availableService)) {
|
||||
return $availableService;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if a selected skipass matches an available skipass.
|
||||
*
|
||||
* @param mixed $selectedService The selected skipass from form data
|
||||
* @param Service $availableService The available skipass to compare against
|
||||
*
|
||||
* @return bool True if the skipasses match, false otherwise
|
||||
*/
|
||||
private function servicesMatch(mixed $selectedService, Service $availableService): bool
|
||||
{
|
||||
// Direct object comparison
|
||||
if ($selectedService === $availableService) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ID comparison for Service objects
|
||||
if ($selectedService instanceof Service) {
|
||||
return $selectedService->id === $availableService->id;
|
||||
}
|
||||
|
||||
// ID comparison for numeric values
|
||||
if (is_numeric($selectedService)) {
|
||||
return (int) $selectedService === $availableService->id;
|
||||
}
|
||||
|
||||
// String ID comparison
|
||||
if (is_string($selectedService)) {
|
||||
return $selectedService === (string) $availableService->id;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user