Completed
Pull Request — master (#22)
by Gabrijel
05:12
created
src/SocialShare/Provider/Twitter.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -93,6 +93,9 @@
 block discarded – undo
93 93
         }
94 94
     }
95 95
 
96
+    /**
97
+     * @return boolean|string
98
+     */
96 99
     private function findNext($haystack)
97 100
     {
98 101
         $max_id_next = false;
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -64,19 +64,19 @@  discard block
 block discarded – undo
64 64
             'count' => 100, // increase limit to REST API maximum: 100.
65 65
         );
66 66
 
67
-        if($max_id) {
67
+        if ($max_id) {
68 68
             $params['max_id'] = $max_id;
69 69
         }
70 70
 
71
-        if($this->oauth_token && $this->oauth_secret) {
71
+        if ($this->oauth_token && $this->oauth_secret) {
72 72
             $connection = $this->getConnectionWithAccessToken($this->oauth_token, $this->oauth_secret);
73 73
             $content = $connection->get("search/tweets", $params);
74 74
 
75 75
             $this->count += count($content->statuses);
76 76
 
77 77
             // paginated search, are there any 'next' results?
78
-            if(isset($content->search_metadata->next_results)) {
79
-                if($max_id_next = $this->findNext($content->search_metadata->next_results)) {
78
+            if (isset($content->search_metadata->next_results)) {
79
+                if ($max_id_next = $this->findNext($content->search_metadata->next_results)) {
80 80
                     $this->getShares($url, $max_id_next);
81 81
                 }
82 82
             }
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 
88 88
     private function getConnectionWithAccessToken($oauth_token, $oauth_secret)
89 89
     {
90
-        if($this->consumer_key && $this->consumer_secret) {
90
+        if ($this->consumer_key && $this->consumer_secret) {
91 91
             $connection = new TwitterOAuth($this->consumer_key, $this->consumer_secret, $oauth_token, $oauth_secret);
92 92
             return $connection;
93 93
         }
@@ -98,13 +98,13 @@  discard block
 block discarded – undo
98 98
         $max_id_next = false;
99 99
         $max_id_search = explode('?', $haystack);
100 100
 
101
-        if(isset($max_id_search[1])) {
101
+        if (isset($max_id_search[1])) {
102 102
             $max_id_search = explode('&', $max_id_search[1]);
103 103
 
104 104
             foreach ($max_id_search as $key => $value) {
105
-                if(strpos($value, 'max_id=') !== false) {
105
+                if (strpos($value, 'max_id=') !== false) {
106 106
                     $max_id_found = explode('=', $value);
107
-                    if(isset($max_id_found[1])) {
107
+                    if (isset($max_id_found[1])) {
108 108
                         $max_id_next = $max_id_found[1];
109 109
                     }
110 110
                 }
Please login to merge, or discard this patch.
examples/buttons.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -25,9 +25,9 @@
 block discarded – undo
25 25
 $socialShare->registerProvider(new Tumblr());
26 26
 
27 27
 // Create an app here: https://apps.twitter.com/
28
-$twitterConsumerKey    = '__set_to_your_app_key__';             // app / Keys and Access Tokens, use "Consumer Key"
29
-$twitterConsumerSecret = '__set_to_your_app_secret__';          // app / Keys and Access Tokens, use "Consumer Secret"
30
-$twitterOauthToken     = '__set_to_your_access_token__';        // app / Keys and Access Tokens, use "Access Token" (generate access token and secret)
28
+$twitterConsumerKey    = '__set_to_your_app_key__'; // app / Keys and Access Tokens, use "Consumer Key"
29
+$twitterConsumerSecret = '__set_to_your_app_secret__'; // app / Keys and Access Tokens, use "Consumer Secret"
30
+$twitterOauthToken     = '__set_to_your_access_token__'; // app / Keys and Access Tokens, use "Access Token" (generate access token and secret)
31 31
 $twitterOauthSecret    = '__set_to_your_access_token_secret__'; // app / Keys and Access Tokens, use "Access Token Secret" (generate access token and secret)
32 32
 
33 33
 $socialShare->registerProvider(new Twitter($twitterConsumerKey, $twitterConsumerSecret, $twitterOauthToken, $twitterOauthSecret));
Please login to merge, or discard this patch.