Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make methods protected for subclassability #17

Merged
merged 1 commit into from
Jul 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [Unreleased]

* [#15](https://github.com/DripEmail/drip-php/pull/15) - Added `\Drip\Client#create_or_update_subscribers` method (@j831)
* Make private methods protected so that people can subclass. Fixes [#16](https://github.com/DripEmail/drip-php/issues/16)
* Your improvement here!

## 1.0.0
Expand Down
18 changes: 9 additions & 9 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@ class Client
const VERSION = '1.0.0';

/** @var string */
private $api_token = '';
protected $api_token = '';
/** @var string */
private $account_id = '';
protected $account_id = '';
/** @var string */
private $api_end_point = 'https://api.getdrip.com/v2/';
protected $api_end_point = 'https://api.getdrip.com/v2/';
/** @var integer */
private $timeout = 30;
protected $timeout = 30;
/** @var integer */
private $connect_timeout = 30;
protected $connect_timeout = 30;

/** @var callable */
private $guzzle_stack_constructor;
protected $guzzle_stack_constructor;

const GET = "GET";
const POST = "POST";
Expand Down Expand Up @@ -288,7 +288,7 @@ public function record_event($params)
/**
* @return string
*/
private function user_agent()
protected function user_agent()
{
return "Drip API PHP Wrapper (getdrip.com). Version " . self::VERSION;
}
Expand All @@ -299,7 +299,7 @@ private function user_agent()
* @param int $code
* @return boolean
*/
private function is_success_response($code)
protected function is_success_response($code)
{
return $code >= 200 && $code <= 299;
}
Expand All @@ -312,7 +312,7 @@ private function is_success_response($code)
* @return \Drip\ResponseInterface
* @throws Exception
*/
private function make_request($url, $params = array(), $req_method = self::GET)
protected function make_request($url, $params = array(), $req_method = self::GET)
{
if ($this->guzzle_stack_constructor) {
// This can be replaced with `($this->guzzle_stack_constructor)()` once we drop PHP5 support.
Expand Down
4 changes: 2 additions & 2 deletions src/Error.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
class Error
{
/** @var string */
private $code;
protected $code;
/** @var string */
private $message;
protected $message;

/**
* @param string $code Coded error reason
Expand Down