예제 #1
0
 public function testGetPrimaryPhone()
 {
     $contact = new Contact();
     $this->assertNull($contact->getPrimaryPhone());
     $phone = new ContactPhone('06001122334455');
     $contact->addPhone($phone);
     $this->assertNull($contact->getPrimaryPhone());
     $contact->setPrimaryPhone($phone);
     $this->assertSame($phone, $contact->getPrimaryPhone());
     $phone2 = new ContactPhone('22001122334455');
     $contact->addPhone($phone2);
     $contact->setPrimaryPhone($phone2);
     $this->assertSame($phone2, $contact->getPrimaryPhone());
     $this->assertFalse($phone->isPrimary());
 }
예제 #2
0
 /**
  * Gets a phone number of the given Contact object
  *
  * @param Contact $object
  *
  * @return string|null
  */
 public function getPhoneNumber($object)
 {
     $primaryPhone = $object->getPrimaryPhone();
     return $primaryPhone ? $primaryPhone->getPhone() : null;
 }