public function testIsEmpty()
 {
     $this->assertTrue($this->address->isEmpty());
     $this->address->setPrimary(true);
     $this->assertFalse($this->address->isEmpty());
     $this->address->setPrimary(false);
     $this->address->addType(new AddressType('billing'));
     $this->assertFalse($this->address->isEmpty());
 }
 /**
  * Only one address must be primary.
  *
  * @param AbstractTypedAddress $address
  * @param AbstractTypedAddress[] $allAddresses
  */
 protected function handlePrimary(AbstractTypedAddress $address, $allAddresses)
 {
     if ($address->isPrimary()) {
         /** @var AbstractTypedAddress[] $allAddresses */
         foreach ($allAddresses as $otherAddresses) {
             $otherAddresses->setPrimary(false);
         }
         $address->setPrimary(true);
     } elseif (count($allAddresses) == 1) {
         $address->setPrimary(true);
     }
 }