public function buildPerson(Person $person) { $data = []; $data['REV'] = $person->getLastUpdated()->format(self::DATE_FORMAT); $data['KIND'] = 'individual'; switch ($person->getGender()) { case Person::GENDER_FEMALE: $data['GENDER'] = 'F'; break; case Person::GENDER_MALE: $data['GENDER'] = 'M'; break; default: break; } $data['FN'] = $person->getFullName(); $data['N'] = [$person->getFirstName(), $person->getLastName(), null, $person->getPrefix()]; //if ($person->getDateOfBirth() !== null) { // $data['BDAY'] = $person->getDateOfBirth()->format('Ymd'); //} //$data['BIRTHPLACE'] = ''; //$data['DEATHDATE'] = ''; //$data['DEATHPLACE'] = ''; //$data['IMPP:aim'] = '*****@*****.**'; if ($person->getNickname() !== null) { $data['NICKNAME'] = $person->getNickname(); } if ($person->getNotes() !== null) { $data['NOTE'] = $person->getNotes(); } //if ($person->getRole() !== null) { // $data['ROLE'] = $person->getRole(); //} //$data['TEL;TYPE=cell'] = '(123) 555-5832'; return $this->buildObject($data); }
private function extractPerson(Person $item, array &$data) { $data['type'] = 'person'; $data['gender'] = $item->getGender(); $data['first_name'] = $item->getFirstName(); $data['phonetic_first_name'] = $item->getPhoneticFirstName(); $data['middle_name'] = $item->getMiddleName(); $data['phonetic_middle_name'] = $item->getPhoneticMiddleName(); $data['last_name'] = $item->getLastName(); $data['phonetic_last_name'] = $item->getPhoneticLastName(); $data['maiden_name'] = $item->getMaidenName(); $data['suffix'] = $item->getSuffix(); $data['nickname'] = $item->getNickname(); $data['job_title'] = $item->getJobTitle(); $data['department'] = $item->getDepartment(); $data['company'] = $item->getCompany(); }