Files
myep/src/BusProNet/Model/AgeConstraintResult.php
T

41 lines
1.1 KiB
PHP

<?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();
}
}