constantcontact/php-sdk — pull request #3 by katzwebservices (2013-04-11 17:44:25+00:00)
Title: Allow sub-classes access to Services

Here's my dilemma: I want to use a different REST Client for the services, but because they are private, I would otherwise need to copy all the methods into my subclass in order to override the ConstantContact REST client. This way, I can do the following:

```
class ExampleSubClass extends ConstantContact {
public function __construct($apiKey) {
parent::__construct($apiKey);
$this->setRestClient(new CustomRestClient());
}

function setRestClient($restClient) {
$this->contactService->setRestClient($restClient);
$this->emailMarketingService->setRestClient($restClient);
$this->activityService->setRestClient($restClient);
$this->campaignTrackingService->setRestClient($restClient);
$this->contactTrackingService->setRestClient($restClient);
$this->campaignScheduleService->setRestClient($restClient);
$this->listService->setRestClient($restClient);
$this->accountService->setRestClient($restClient);
}
}
```

If there's a better way I don't know about, please let me know. Allowing sub-classes access seems like an easy way to add lots of flexibility without much risk.