* @created 2025-08-08 * @location Made in Germany 🇩🇪 */ class UserDTO { public function __construct( public readonly string $first_name, public readonly string $last_name, public readonly string $email, public readonly ?string $phone = null, public readonly ?string $profession = null, public readonly ?string $location = null, public readonly ?string $status = 'active' ) {} public function toArray(): array { return [ 'first_name' => $this->first_name, 'last_name' => $this->last_name, 'email' => $this->email, 'phone' => $this->phone, 'profession' => $this->profession, 'location' => $this->location, 'status' => $this->status, ]; } public static function fromArray(array $data): self { return new self( first_name: $data['first_name'], last_name: $data['last_name'], email: $data['email'], phone: $data['phone'] ?? null, profession: $data['profession'] ?? null, location: $data['location'] ?? null, status: $data['status'] ?? 'active' ); } }