src/Core/Communicator.php
public function edit(UpdatableComponentInterface $component): UpdatableComponentInterface
    {
        switch (get_class($component)) {
            case "IP1\RESTClient\Recipient\ProcessedContact":
                $response = $this->sendRequest(
                    "api/contacts/".$component->getID(),
                    "PUT",
                    json_encode($component)
                );
                return RecipientFactory::createProcessedContactFromJSON($response);

            case "IP1\RESTClient\Recipient\ProcessedGroup":
                $response = $this->sendRequest(
                    "api/groups/".$component->getID(),
                    "PUT",
                    json_encode($component)
                );
                return RecipientFactory::createProcessedGroupFromJSON($response);
            default:
                throw new \InvalidArgumentException("Given JsonSerializable not supported.");
        }
    }
public function edit(UpdatableComponentInterface $component): UpdatableComponentInterface
    {
        switch (get_class($component)) {
            case "IP1\RESTClient\Recipient\ProcessedContact":
                $response = $this->sendRequest(
                    "api/contacts/".$component->getID(),
                    "PUT",
                    json_encode($component)
                );
                return RecipientFactory::createProcessedContactFromJSON($response);

            case "IP1\RESTClient\Recipient\ProcessedGroup":
                $response = $this->sendRequest(
                    "api/groups/".$component->getID(),
                    "PUT",
                    json_encode($component)
                );
                return RecipientFactory::createProcessedGroupFromJSON($response);
            default:
                throw new \InvalidArgumentException("Given JsonSerializable not supported.");
        }
    }
public function edit ( UpdatableComponentInterface $ component ) : UpdatableComponentInterface { switch ( get_class ( $ component ) ) { case "IP1\RESTClient\Recipient\ProcessedContact" : $ response = $ this -> sendRequest ( "api/contacts/" . $ component -> getID ( ) , "PUT" , json_encode ( $ component ) ) ; return RecipientFactory :: createProcessedContactFromJSON ( $ response ) ; case "IP1\RESTClient\Recipient\ProcessedGroup" : $ response = $ this -> sendRequest ( "api/groups/" . $ component -> getID ( ) , "PUT" , json_encode ( $ component ) ) ; return RecipientFactory :: createProcessedGroupFromJSON ( $ response ) ; default : throw new \ InvalidArgumentException ( "Given JsonSerializable not supported." ) ; } }
Edits the param to the API and returns the response as the corresponding object.
@param UpdatableComponentInterface $component A Contact, Group, Membership.
@return UpdatableComponentInterface ProcessedContact, ProcessedGroup or PrcessedMembership.
@throws \InvalidArgumentException When param isn't any of the classes listed in param args.
Edits the param to the API and returns the response as the corresponding object .