feat: simplify xml parsing, add 'mutable' property for personal data

This commit is contained in:
Björn Fromme
2025-01-30 10:40:38 +01:00
parent c75f069ce0
commit eae9879519
8 changed files with 47 additions and 32 deletions
@@ -18,4 +18,33 @@ abstract class AbstractParser
{
return 0 < $node->count() ? (int) $node->text() : null;
}
protected function getFloatOrNullValue(Crawler $node): ?float
{
return 0 < $node->count() ? $this->stringToFloat($node->text()) : null;
}
protected function getDateOrNullValue(Crawler $node): ?\DateTimeImmutable
{
return 0 < $node->count() ? $this->stringToDate($node->text()) : null;
}
protected function getDateTimeOrNullValue(Crawler $node): ?\DateTimeImmutable
{
return 0 < $node->count() ? $this->stringToDateTime($node->text()) : null;
}
protected function getBoolValue(Crawler $node): bool
{
return 0 < $node->count() && $this->stringToBool($node->text());
}
protected function getArrayValue(Crawler $node, string $separator = ','): array
{
if (0 === $node->count()) {
return [];
}
return $this->stringToArray($node->text(), $separator);
}
}