[BUGFIX] Remove count parameter from reposiory functions 70/23170/2
authorNicole Cordes <cordes@cps-it.de>
Sat, 17 Aug 2013 23:30:07 +0000 (01:30 +0200)
committerNicole Cordes <typo3@cordes.co>
Sat, 17 Aug 2013 23:31:29 +0000 (01:31 +0200)
As the limit is set within the settings we can use that.

Releases: 1.0
Change-Id: I7d3990e904f4444164633aade495a1a43ab18d13
Reviewed-on: https://review.typo3.org/23170
Reviewed-by: Nicole Cordes
Tested-by: Nicole Cordes
Classes/Controller/TwitterController.php
Classes/Domain/Repository/TweetRepository.php

index 64bca70..ae80566 100644 (file)
@@ -79,10 +79,10 @@ class Tx_WtTwitter_Controller_TwitterController extends Tx_Extbase_MVC_Controlle
 
                switch ($this->settings['mode']) {
                        case 'showOwn':
-                               $tweets = $this->tweetRepository->getTweetsFromUserTimeline($this->settings, $this->settings['limit'], $response);
+                               $tweets = $this->tweetRepository->getTweetsFromUserTimeline($this->settings, $response);
                                break;
                        case 'showFromSearch':
-                               $tweets = $this->tweetRepository->getTweetsFromSearch($this->settings, $this->settings['limit'], $response);
+                               $tweets = $this->tweetRepository->getTweetsFromSearch($this->settings, $response);
                                break;
                }
                // Look up for any errors
index 8863f34..6d7ba77 100644 (file)
@@ -62,32 +62,10 @@ class Tx_WtTwitter_Domain_Repository_TweetRepository {
 
        /**
         * @param array $settings
-        * @param integer $count
-        * @param NULL $response
-        * @return array
-        */
-       public function getTweetsFromSearch($settings, $count, &$response = NULL) {
-               $tweets = array();
-
-               if ($this->isTwitterSigned()&& $this->isCurlActivated()) {
-                       $parameter = array(
-                               'q' => $settings['hashtag']
-                       );
-
-                       $result = $this->callApi(Tx_WtTwitter_Twitter_Api::getSearchTweetsUrl(), 'GET', $parameter, $response);
-                       $tweets = $result->statuses;
-               }
-
-               return $this->addOldUserInformation($this->sliceTweets($tweets, $count));
-       }
-
-       /**
-        * @param array $settings
-        * @param integer $count
         * @param NULL $response
         * @return array
         */
-       public function getTweetsFromUserTimeline($settings, $count, &$response = NULL) {
+       public function getTweetsFromUserTimeline($settings, &$response = NULL) {
                $tweets = array();
 
                if ($this->isTwitterSigned() && $this->isCurlActivated()) {
@@ -117,7 +95,27 @@ class Tx_WtTwitter_Domain_Repository_TweetRepository {
                        $tweets = $this->callApi(Tx_WtTwitter_Twitter_Api::getStatusesUserTimelineUrl(), 'GET', $parameter, $response);
                }
 
-               return $this->addOldUserInformation($this->sliceTweets($tweets, $count));
+               return $this->addOldUserInformation($this->sliceTweets($tweets, $settings['limit']));
+       }
+
+       /**
+        * @param array $settings
+        * @param NULL $response
+        * @return array
+        */
+       public function getTweetsFromSearch($settings, &$response = NULL) {
+               $tweets = array();
+
+               if ($this->isTwitterSigned()&& $this->isCurlActivated()) {
+                       $parameter = array(
+                               'q' => $settings['hashtag']
+                       );
+
+                       $result = $this->callApi(Tx_WtTwitter_Twitter_Api::getSearchTweetsUrl(), 'GET', $parameter, $response);
+                       $tweets = $result->statuses;
+               }
+
+               return $this->addOldUserInformation($this->sliceTweets($tweets, $settings['limit']));
        }
 
        /**