/** * @param Sex $sex * @param int $estimatedAge * @return static */ public static function anonymous(Sex $sex, $estimatedAge) { $name = FullName::fromParts('John', 'Doe'); if ($sex->isFemale()) { $name = FullName::fromParts('Jane', 'Doe'); } return new static($name, BirthDate::fromEstimatedAge($estimatedAge), $sex); }
public function __invoke(RegisterWalkIn $registerWalkIn) { $patient = Patient::walkIn(PersonalInformation::fromDetails(FullName::fromParts($registerWalkIn->firstName, $registerWalkIn->lastName), BirthDate::fromYearMonthDayFormat($registerWalkIn->dateOfBirth), new Sex($registerWalkIn->sex), $registerWalkIn->patientId), $registerWalkIn->indication, $registerWalkIn->patientId); $this->patientRepository->add($patient); }