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

            case "IP1\RESTClient\Recipient\ProcessedGroup":
                $response = $this->sendRequest("api/groups/".$component->getID(), "DELETE");
                return RecipientFactory::createProcessedGroupFromJSON($response);

            case "IP1\RESTClient\Recipient\ProcessedMembership":
                $response = $this->sendRequest("api/memberships/".$component->getID(), "DELETE");
                return RecipientFactory::createProcessedMembershipFromJSON($response);

            case "IP1\RESTClient\Recipient\ProcessedBlacklistEntry":
                $response = $this->sendRequest("api/blacklist/".$component->getID(), "DELETE");
                $stdResponse = json_decode($response);
                $created = new \DateTime($stdResponse->Created);
                return new ProcessedBlacklistEntry($stdResponse->Phone, $stdResponse->ID, $created);

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

            case "IP1\RESTClient\Recipient\ProcessedGroup":
                $response = $this->sendRequest("api/groups/".$component->getID(), "DELETE");
                return RecipientFactory::createProcessedGroupFromJSON($response);

            case "IP1\RESTClient\Recipient\ProcessedMembership":
                $response = $this->sendRequest("api/memberships/".$component->getID(), "DELETE");
                return RecipientFactory::createProcessedMembershipFromJSON($response);

            case "IP1\RESTClient\Recipient\ProcessedBlacklistEntry":
                $response = $this->sendRequest("api/blacklist/".$component->getID(), "DELETE");
                $stdResponse = json_decode($response);
                $created = new \DateTime($stdResponse->Created);
                return new ProcessedBlacklistEntry($stdResponse->Phone, $stdResponse->ID, $created);

            default:
                throw new \InvalidArgumentException("Given JsonSerializable not supported.");
        }
    }
public function remove ( ProcessedComponentInterface $ component ) : ProcessedComponentInterface { switch ( get_class ( $ component ) ) { case "IP1\RESTClient\Recipient\ProcessedContact" : $ response = $ this -> sendRequest ( "api/contacts/" . $ component -> getID ( ) , "DELETE" ) ; return RecipientFactory :: createProcessedContactFromJSON ( $ response ) ; case "IP1\RESTClient\Recipient\ProcessedGroup" : $ response = $ this -> sendRequest ( "api/groups/" . $ component -> getID ( ) , "DELETE" ) ; return RecipientFactory :: createProcessedGroupFromJSON ( $ response ) ; case "IP1\RESTClient\Recipient\ProcessedMembership" : $ response = $ this -> sendRequest ( "api/memberships/" . $ component -> getID ( ) , "DELETE" ) ; return RecipientFactory :: createProcessedMembershipFromJSON ( $ response ) ; case "IP1\RESTClient\Recipient\ProcessedBlacklistEntry" : $ response = $ this -> sendRequest ( "api/blacklist/" . $ component -> getID ( ) , "DELETE" ) ; $ stdResponse = json_decode ( $ response ) ; $ created = new \ DateTime ( $ stdResponse -> Created ) ; return new ProcessedBlacklistEntry ( $ stdResponse -> Phone , $ stdResponse -> ID , $ created ) ; default : throw new \ InvalidArgumentException ( "Given JsonSerializable not supported." ) ; } }
Removes the param to the API and returns the response as the corresponding object.
@param ProcessedComponentInterface $component A Contact, Group, Membership.
@return ProcessedComponentInterface ProcessedContact, ProcessedGroup, PrcessedMembership or a ClassValidatinArray
filled with ProcessedOutGoingSMS.
@throws \InvalidArgumentException When param isn't any of the classes listed in param args.
Removes the param to the API and returns the response as the corresponding object .