public function removeAddress(AddressInterface $address)
    {
        if (!$this->hasAddress($address)) {
            throw new \InvalidArgumentException('Trying to remove an address that does not belong to this contact');
        }

        $this->addresses->removeElement($address);

        if ($address === $this->defaultAddress) {
            if ($this->addresses->count() > 0) {
                $this->defaultAddress = $this->addresses->first();

                return;
            }

            $this->defaultAddress = null;
        }
    }
public function removeAddress(AddressInterface $address)
    {
        if (!$this->hasAddress($address)) {
            throw new \InvalidArgumentException('Trying to remove an address that does not belong to this contact');
        }

        $this->addresses->removeElement($address);

        if ($address === $this->defaultAddress) {
            if ($this->addresses->count() > 0) {
                $this->defaultAddress = $this->addresses->first();

                return;
            }

            $this->defaultAddress = null;
        }
    }
public function removeAddress ( AddressInterface $ address ) { if ( ! $ this -> hasAddress ( $ address ) ) { throw new \ InvalidArgumentException ( 'Trying to remove an address that does not belong to this contact' ) ; } $ this -> addresses -> removeElement ( $ address ) ; if ( $ address === $ this -> defaultAddress ) { if ( $ this -> addresses -> count ( ) > 0 ) { $ this -> defaultAddress = $ this -> addresses -> first ( ) ; return ; } $ this -> defaultAddress = null ; } }
Remove an Address from the collection.

@param AddressInterface $address
Remove an Address from the collection .