public function addPhone(PhoneInterface $phone)
    {
        if ($this->phones->contains($phone)) {
            throw new \InvalidArgumentException('This contact already owns this phone');
        }

        $this->phones->add($phone);

        if (!$this->defaultPhone) {
            $this->setDefaultPhone($phone);
        }
    }
public function addPhone(PhoneInterface $phone)
    {
        if ($this->phones->contains($phone)) {
            throw new \InvalidArgumentException('This contact already owns this phone');
        }

        $this->phones->add($phone);

        if (!$this->defaultPhone) {
            $this->setDefaultPhone($phone);
        }
    }
public function addPhone ( PhoneInterface $ phone ) { if ( $ this -> phones -> contains ( $ phone ) ) { throw new \ InvalidArgumentException ( 'This contact already owns this phone' ) ; } $ this -> phones -> add ( $ phone ) ; if ( ! $ this -> defaultPhone ) { $ this -> setDefaultPhone ( $ phone ) ; } }
Add a Phone to the collection.

@param PhoneInterface $phone
Add a Phone to the collection .