wip: age based filtering of options

This commit is contained in:
Björn Fromme
2026-03-16 11:59:09 +01:00
parent b038d9a41f
commit 7003c0d81b
17 changed files with 845 additions and 23 deletions
+2 -2
View File
@@ -19,7 +19,7 @@ class AgeConstraintResult
public readonly ?int $birthYearFrom = null,
public readonly ?int $birthYearTo = null,
public readonly array $metadata = [],
public readonly ?string $rawData = null
public readonly ?string $rawData = null,
) {
}
@@ -37,4 +37,4 @@ class AgeConstraintResult
{
return false === $this->hasAgeConstraints() && false === $this->hasBirthYearConstraints();
}
}
}
@@ -42,4 +42,4 @@ interface AgeConstraintParserInterface
* @return string The constraint type identifier (e.g., 'birth_year', 'grade_level')
*/
public function getConstraintType(): string;
}
}
@@ -112,4 +112,4 @@ class AgeConstraintParserRegistry
return min($current, $new); // Most restrictive maximum
}
}
}
@@ -24,7 +24,7 @@ class BirthYearConstraintParser implements AgeConstraintParserInterface
public function parse(string $constraintData): AgeConstraintResult
{
if (false === $this->canParse($constraintData)) {
throw new \InvalidArgumentException('Cannot parse constraint data: ' . $constraintData);
throw new \InvalidArgumentException('Cannot parse constraint data: '.$constraintData);
}
$yearData = substr($constraintData, strlen(self::BIRTH_YEAR_PREFIX));
@@ -64,4 +64,4 @@ class BirthYearConstraintParser implements AgeConstraintParserInterface
{
return 'birth_year';
}
}
}
+1
View File
@@ -28,6 +28,7 @@ class TravelParser extends AbstractParser
{
$this->ageConstraintRegistry = new AgeConstraintParserRegistry();
}
/**
* Parse XML node into a Travel object.
*