8000 Use protected keyword for methods that may be overriden in extended c… · codezninja/codebird-php@5e3148c · GitHub
[go: up one dir, main page]

Skip to content

Commit 5e3148c

Browse files
committed
Use protected keyword for methods that may be overriden in extended classes
1 parent 602765e commit 5e3148c

File tree

3 files changed

+23
-20
lines changed

3 files changed

+23
-20
lines changed

CHANGELOG

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
codebird-php - changelog
22
========================
33

4+
2.3.2 (2013-04-09)
5+
+ Use protected keyword for methods that may be overriden in extended classes
6+
47
2.3.1 (2013-03-23)
58
- Re-remove statuses/sample. It's streaming API, which Codebird doesn't currently support
69
+ Don't send multipart POST to non-multipart methods, fix issue #8

composer.json

Lines changed: 1 addition & 1 deletion
Original file line num 10000 berDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "mynetx/codebird-php",
33
"description" : "A Twitter library in PHP.",
4-
"version": "2.3.1",
4+
"version": "2.3.2",
55
"autoload": {
66
"classmap": ["src/"]
77
},

src/codebird.php

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* A Twitter library in PHP.
55
*
66
* @package codebird
7-
* @version 2.3.1
7+
* @version 2.3.2
88
* @author J.M. <me@mynetx.net>
99
* @copyright 2010-2013 J.M. <me@mynetx.net>
1010
*
@@ -49,52 +49,52 @@ class Codebird
4949
/**
5050
* The OAuth consumer key of your registered app
5151
*/
52-
private static $_oauth_consumer_key = null;
52+
protected static $_oauth_consumer_key = null;
5353

5454
/**
5555
* The corresponding consumer secret
5656
*/
57-
private static $_oauth_consumer_secret = null;
57+
protected static $_oauth_consumer_secret = null;
5858

5959
/**
6060
* The app-only bearer token. Used to authorize app-only requests
6161
*/
62-
private static $_oauth_bearer_token = null;
62+
protected static $_oauth_bearer_token = null;
6363

6464
/**
6565
* The API endpoint to use
6666
*/
67-
private static $_endpoint = 'https://api.twitter.com/1.1/';
67+
protected static $_endpoint = 'https://api.twitter.com/1.1/';
6868

6969
/**
7070
* The API endpoint to use for OAuth requests
7171
*/
72-
private static $_endpoint_oauth = 'https://api.twitter.com/';
72+
protected static $_endpoint_oauth = 'https://api.twitter.com/';
7373

7474
/**
7575
* The Request or access token. Used to sign requests
7676
*/
77-
private $_oauth_token = null;
77+
protected $_oauth_token = null;
7878

7979
/**
8080
* The corresponding request or access token secret
8181
*/
82-
private $_oauth_token_secret = null;
82+
protected $_oauth_token_secret = null;
8383

8484
/**
8585
* The format of data to return from API calls
8686
*/
87-
private $_return_format = CODEBIRD_RETURNFORMAT_OBJECT;
87+
protected $_return_format = CODEBIRD_RETURNFORMAT_OBJECT;
8888

8989
/**
9090
* The file formats that Twitter accepts as image uploads
9191
*/
92-
private $_supported_media_files = array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG);
92+
protected $_supported_media_files = array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG);
9393

9494
/**
9595
* The current Codebird version
9696
*/
97-
private $_version = '2.3.1';
97+
protected $_version = '2.3.2';
9898

9999
/**
100100
* Returns singleton class instance
@@ -414,7 +414,7 @@ private function _sha1($data)
414414
*
415415
* @return string The random string
416416
*/
417-
private function _nonce($length = 8)
417+
protected function _nonce($length = 8)
418418
{
419419
if ($length < 1) {
420420
throw new Exception('Invalid nonce length.');
@@ -431,7 +431,7 @@ private function _nonce($length = 8)
431431
*
432432
* @return string Authorization HTTP header
433433
*/
434-
private function _sign($httpmethod, $method, $params = array())
434+
protected function _sign($httpmethod, $method, $params = array())
435435
{
436436
if (self::$_oauth_consumer_key == null) {
437437
throw new Exception('To generate a signature, the consumer key must be set.');
@@ -481,7 +481,7 @@ private function _sign($httpmethod, $method, $params = array())
481481
*
482482
* @return string The HTTP method that should be used
483483
*/
484-
private function _detectMethod($method, $params)
484+
protected function _detectMethod($method, $params)
485485
{
486486
// multi-HTTP method endpoints
487487
switch($method) {
@@ -653,7 +653,7 @@ private function _detectMethod($method, $params)
653653
*
654654
* @return bool Whether the method should be sent as multipart
655655
*/
656-
private function _detectMultipart($method)
656+
protected function _detectMultipart($method)
657657
{
658658
$multiparts = array(
659659
// Tweets
@@ -675,7 +675,7 @@ private function _detectMultipart($method)
675675
*
676676
* @return void
677677
*/
678-
private function _detectFilenames($method, &$params)
678+
protected function _detectFilenames($method, &$params)
679679
{
680680
// well, files will only work in multipart methods
681681
if (! $this->_detectMultipart($method)) {
@@ -743,7 +743,7 @@ private function _detectFilenames($method, &$params)
743743
*
744744
* @return string The URL to send the request to
745745
*/
746-
private function _getEndpoint($method, $method_template)
746+
protected function _getEndpoint($method, $method_template)
747747
{
748748
if (substr($method, 0, 5) == 'oauth') {
749749
$url = self::$_endpoint_oauth . $method;
@@ -766,7 +766,7 @@ private function _getEndpoint($method, $method_template)
766766
* @return mixed The API reply, encoded in the set return_format
767767
*/
768768

769-
private function _callApi($httpmethod, $method, $method_template, $params = array(), $multipart = false, $app_only_auth = false)
769+
protected function _callApi($httpmethod, $method, $method_template, $params = array(), $multipart = false, $app_only_auth = false)
770770
{
771771
if (! function_exists('curl_init')) {
772772
throw new Exception('To make API requests, the PHP curl extension must be available.');
@@ -831,7 +831,7 @@ private function _callApi($httpmethod, $method, $method_template, $params = arra
831831
*
832832
* @return array|object The parsed reply
833833
*/
834-
private function _parseApiReply($method, $reply)
834+
protected function _parseApiReply($method, $reply)
835835
{
836836
// split headers and body
837837
$headers = array();

0 commit comments

Comments
 (0)
0