Skip to content

Commit 778ac4e

Browse files
authored
Merge pull request #17 from DripEmail/16-make-methods-protected
Make methods protected for subclassability
2 parents 7a76a3b + d2faf03 commit 778ac4e

3 files changed

Lines changed: 12 additions & 11 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77
## [Unreleased]
88

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

1213
## 1.0.0

src/Client.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,18 @@ class Client
1717
const VERSION = '1.0.0';
1818

1919
/** @var string */
20-
private $api_token = '';
20+
protected $api_token = '';
2121
/** @var string */
22-
private $account_id = '';
22+
protected $account_id = '';
2323
/** @var string */
24-
private $api_end_point = 'https://api.getdrip.com/v2/';
24+
protected $api_end_point = 'https://api.getdrip.com/v2/';
2525
/** @var integer */
26-
private $timeout = 30;
26+
protected $timeout = 30;
2727
/** @var integer */
28-
private $connect_timeout = 30;
28+
protected $connect_timeout = 30;
2929

3030
/** @var callable */
31-
private $guzzle_stack_constructor;
31+
protected $guzzle_stack_constructor;
3232

3333
const GET = "GET";
3434
const POST = "POST";
@@ -288,7 +288,7 @@ public function record_event($params)
288288
/**
289289
* @return string
290290
*/
291-
private function user_agent()
291+
protected function user_agent()
292292
{
293293
return "Drip API PHP Wrapper (getdrip.com). Version " . self::VERSION;
294294
}
@@ -299,7 +299,7 @@ private function user_agent()
299299
* @param int $code
300300
* @return boolean
301301
*/
302-
private function is_success_response($code)
302+
protected function is_success_response($code)
303303
{
304304
return $code >= 200 && $code <= 299;
305305
}
@@ -312,7 +312,7 @@ private function is_success_response($code)
312312
* @return \Drip\ResponseInterface
313313
* @throws Exception
314314
*/
315-
private function make_request($url, $params = array(), $req_method = self::GET)
315+
protected function make_request($url, $params = array(), $req_method = self::GET)
316316
{
317317
if ($this->guzzle_stack_constructor) {
318318
// This can be replaced with `($this->guzzle_stack_constructor)()` once we drop PHP5 support.

src/Error.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
class Error
99
{
1010
/** @var string */
11-
private $code;
11+
protected $code;
1212
/** @var string */
13-
private $message;
13+
protected $message;
1414

1515
/**
1616
* @param string $code Coded error reason

0 commit comments

Comments
 (0)