getEmail())) { $missing[] = 'E-Mail'; } if (empty($this->getMobile())) { $missing[] = 'Mobilnummer'; } if (0 < count($missing)) { $executionContext ->buildViolation(sprintf('Bitte vervollständige deine Kontaktdaten (%s)', implode(', ', $missing))) ->addViolation() ; } } public function toPayload(): array { return [ 'email' => $this->getEmail(), 'telefonmobil' => $this->getMobile(), 'telefonprivat' => $this->getPhone(), ]; } public static function fromApiResponse(ProfileResponse $profileResponse): static { $communication = $profileResponse->getCommunication(); $instance = new static(); $instance ->setPhone($communication->getPhone()) ->setMobile($communication->getMobile()) ->setEmail($communication->getEmail()) ; return $instance; } public function getPhone(): ?string { return $this->phone; } public function setPhone(?string $phone): static { $this->phone = $phone; return $this; } public function getMobile(): ?string { return $this->mobile; } public function setMobile(?string $mobile): static { $this->mobile = $mobile; return $this; } public function getEmail(): ?string { return $this->email; } public function setEmail(?string $email): static { $this->email = $email; return $this; } }