wip: age based filtering of options
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -72,4 +72,25 @@ class Service
|
||||
|
||||
#[Groups(['api:single', 'api:list'])]
|
||||
public ?string $direction = null;
|
||||
|
||||
#[Groups(['api:single', 'api:list'])]
|
||||
public ?int $ageFrom = null;
|
||||
|
||||
#[Groups(['api:single', 'api:list'])]
|
||||
public ?int $ageTo = null;
|
||||
|
||||
#[Groups(['api:single', 'api:list'])]
|
||||
public ?int $birthYearFrom = null;
|
||||
|
||||
#[Groups(['api:single', 'api:list'])]
|
||||
public ?int $birthYearTo = null;
|
||||
|
||||
#[Groups(['api:single', 'api:list'])]
|
||||
public ?string $ageConstraintType = null;
|
||||
|
||||
#[Groups(['api:single'])]
|
||||
public ?array $ageConstraintMetadata = null;
|
||||
|
||||
#[Groups(['api:single'])]
|
||||
public ?string $rawAgeConstraintData = null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user