/** * @test * @group metadata * @group contactperson * * @dataProvider \OpenConext\Value\TestDataProvider::notStringOrEmptyString * @expectedException InvalidArgumentException * * @param mixed $invalidData */ public function deserialization_requires_valid_data($invalidData) { Company::deserialize($invalidData); }
public static function deserialize($data) { Assertion::isArray($data); Assertion::keysExist($data, array('contact_type', 'email_address_list', 'telephone_number_list', 'given_name', 'surname', 'company')); $contact = new self(ContactType::deserialize($data['contact_type']), EmailAddressList::deserialize($data['email_address_list']), TelephoneNumberList::deserialize($data['telephone_number_list'])); if ($data['given_name']) { $contact->givenName = GivenName::deserialize($data['given_name']); } if ($data['surname']) { $contact->surname = Surname::deserialize($data['surname']); } if ($data['company']) { $contact->company = Company::deserialize($data['company']); } return $contact; }