src/Recipient/ProcessedContact.php
public function addGroup(Communicator $communicator, ProcessedGroup $group): ProcessedMembership
    {
        $response = $communicator->post('api/memberships', new Membership($group->getID(), $this->contactID));
        $returnValue =  RecipientFactory::createProcessedMembershipFromJSON($response);
        if ($this->memberShipsFetched) {
            $this->memberships[] = $returnValue;
        }
        return $returnValue;
    }
public function addGroup(Communicator $communicator, ProcessedGroup $group): ProcessedMembership
    {
        $response = $communicator->post('api/memberships', new Membership($group->getID(), $this->contactID));
        $returnValue =  RecipientFactory::createProcessedMembershipFromJSON($response);
        if ($this->memberShipsFetched) {
            $this->memberships[] = $returnValue;
        }
        return $returnValue;
    }
public function addGroup ( Communicator $ communicator , ProcessedGroup $ group ) : ProcessedMembership { $ response = $ communicator -> post ( 'api/memberships' , new Membership ( $ group -> getID ( ) , $ this -> contactID ) ) ; $ returnValue = RecipientFactory :: createProcessedMembershipFromJSON ( $ response ) ; if ( $ this -> memberShipsFetched ) { $ this -> memberships [ ] = $ returnValue ; } return $ returnValue ; }
Adds the contact to the given group and returns the membership.
@param Communicator   $communicator Used to fetch Groups from the API.
@param ProcessedGroup $group        The group the contact should be added to.
@return ProcessedMembership
Adds the contact to the given group and returns the membership .