From b035d4a0cf7063088982566168c16090813ff303 Mon Sep 17 00:00:00 2001 From: Ambroise Maupate Date: Tue, 19 Jun 2018 15:53:45 +0200 Subject: [PATCH 1/3] Update composer.json --- composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/composer.json b/composer.json index 70721fb..4f52803 100644 --- a/composer.json +++ b/composer.json @@ -2,6 +2,7 @@ "name": "rezozero/mixedfeed", "description": "A PHP library to get social networks feeds and merge them", "license": "MIT", + "type": "library", "authors": [ { "name": "Ambroise Maupate", From e53c20eb08b49083ad4ccc01ca6d4c6cb57d13a4 Mon Sep 17 00:00:00 2001 From: "nikos.sotiropoulos" Date: Thu, 21 Jun 2018 18:42:09 +0200 Subject: [PATCH 2/3] Add option for extended tweets at TwitterSearchFeed --- src/TwitterSearchFeed.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/TwitterSearchFeed.php b/src/TwitterSearchFeed.php index 751679e..9fbb37c 100644 --- a/src/TwitterSearchFeed.php +++ b/src/TwitterSearchFeed.php @@ -42,6 +42,11 @@ class TwitterSearchFeed extends AbstractTwitterFeed */ protected $includeRetweets = true; + /** + * @var bool + */ + protected $extended = true; + /** * @var string */ @@ -68,7 +73,8 @@ public function __construct( $consumerSecret, $accessToken, $accessTokenSecret, - CacheProvider $cacheProvider = null + CacheProvider $cacheProvider = null, + $extended = false ) { parent::__construct( $consumerKey, @@ -80,6 +86,7 @@ public function __construct( $this->queryParams = array_filter($queryParams); $this->cacheKey = $this->getFeedPlatform() . md5(serialize($queryParams)); + $this->extended = $extended; } /** @@ -117,6 +124,7 @@ protected function getFeed($count = 5) "q" => $this->formatQueryParams(), "count" => $count, "result_type" => $this->resultType, + 'tweet_mode' => ($this->extended ? 'extended' : '') ]; $body = $this->twitterConnection->get("search/tweets", $params); From 8a44b21b3324558d146fc7e03f80b542a0b5b84b Mon Sep 17 00:00:00 2001 From: Ambroise Maupate Date: Thu, 21 Jun 2018 19:09:22 +0200 Subject: [PATCH 3/3] Cleaned new extended param for SearchFeed --- README.md | 21 +++++++++++---------- src/TwitterSearchFeed.php | 8 +++++--- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index d1c90a6..96438c5 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ $feed = new MixedFeed([ new InstagramFeed( 'instagram_user_id', 'instagram_access_token', - // you can add a doctrine cache provider + null // you can add a doctrine cache provider ), new TwitterFeed( 'twitter_user_id', @@ -32,10 +32,10 @@ $feed = new MixedFeed([ 'twitter_consumer_secret', 'twitter_access_token', 'twitter_access_token_secret', - // you can add a doctrine cache provider - // exclude replies true/false - // include retweets true/false - // extended mode true/false + null, // you can add a doctrine cache provider + true, // exclude replies true/false + false, // include retweets true/false + false // extended mode true/false ), new TwitterSearchFeed( [ @@ -48,23 +48,24 @@ $feed = new MixedFeed([ 'twitter_consumer_secret', 'twitter_access_token', 'twitter_access_token_secret', - // you can add a doctrine cache provider + null, // you can add a doctrine cache provider + false // extended mode true/false ), new FacebookPageFeed( 'page-id', 'app_access_token', - // you can add a doctrine cache provider - // And a fields array to retrieve too + null, // you can add a doctrine cache provider + [] // And a fields array to retrieve too ), new GithubCommitsFeed( 'symfony/symfony', 'access_token', - // you can add a doctrine cache provider + null // you can add a doctrine cache provider ), new GithubReleasesFeed( 'roadiz/roadiz', 'access_token', - // you can add a doctrine cache provider + null // you can add a doctrine cache provider ), ]); diff --git a/src/TwitterSearchFeed.php b/src/TwitterSearchFeed.php index 9fbb37c..d0b2ada 100644 --- a/src/TwitterSearchFeed.php +++ b/src/TwitterSearchFeed.php @@ -45,7 +45,7 @@ class TwitterSearchFeed extends AbstractTwitterFeed /** * @var bool */ - protected $extended = true; + protected $extended = false; /** * @var string @@ -65,7 +65,7 @@ class TwitterSearchFeed extends AbstractTwitterFeed * @param string $accessToken * @param string $accessTokenSecret * @param CacheProvider|null $cacheProvider - * @throws Exception\CredentialsException + * @param bool $extended */ public function __construct( array $queryParams, @@ -124,8 +124,10 @@ protected function getFeed($count = 5) "q" => $this->formatQueryParams(), "count" => $count, "result_type" => $this->resultType, - 'tweet_mode' => ($this->extended ? 'extended' : '') ]; + if ($this->extended) { + $params['tweet_mode'] = 'extended'; + } $body = $this->twitterConnection->get("search/tweets", $params);