Resultat ?? false); $anomalyNode = is_object($standardResponseNode) ? ($standardResponseNode->Anomalie ?? null) : null; $anomaly = null; if (is_object($anomalyNode)) { $anomaly = new AnomalyDto( code: $this->toNullableString($anomalyNode->Code ?? null), severity: $this->toNullableInt($anomalyNode->Severite ?? null), message: $this->toNullableString($anomalyNode->Message ?? null), ); } return new StandardResponseDto($result, $anomaly); } private function toNullableString(mixed $value): ?string { if (null === $value) { return null; } $stringValue = trim((string) $value); return '' === $stringValue ? null : $stringValue; } private function toNullableInt(mixed $value): ?int { if (null === $value) { return null; } if (is_int($value)) { return $value; } if (is_numeric($value)) { return (int) $value; } return null; } }