feat: simplify xml parsing, add 'mutable' property for personal data
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user