wip: age based filtering of options

This commit is contained in:
Björn Fromme
2025-08-27 12:42:02 +02:00
parent 803b10f981
commit 25bbf3d44f
11 changed files with 751 additions and 27 deletions
@@ -0,0 +1,40 @@
<?php
declare(strict_types=1);
namespace App\BusProNet\Model;
/**
* Represents the result of parsing age constraint data from XML.
*
* This DTO holds the parsed age constraint information including both absolute age
* constraints and birth year constraints, along with metadata for extensibility.
*/
class AgeConstraintResult
{
public function __construct(
public readonly string $type,
public readonly ?int $ageFrom = null,
public readonly ?int $ageTo = null,
public readonly ?int $birthYearFrom = null,
public readonly ?int $birthYearTo = null,
public readonly array $metadata = [],
public readonly ?string $rawData = null
) {
}
public function hasAgeConstraints(): bool
{
return null !== $this->ageFrom || null !== $this->ageTo;
}
public function hasBirthYearConstraints(): bool
{
return null !== $this->birthYearFrom || null !== $this->birthYearTo;
}
public function isEmpty(): bool
{
return false === $this->hasAgeConstraints() && false === $this->hasBirthYearConstraints();
}
}