Skip to content

Commit

Permalink
Created a method to render tweets
Browse files Browse the repository at this point in the history
  • Loading branch information
pinceladasdaweb committed Nov 1, 2016
1 parent 4816ed4 commit 467fe39
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
9 changes: 2 additions & 7 deletions request.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,5 @@

use Tweets\Tweets;

$tweets = new Tweets();
$timeline = $tweets->user_timeline();
$hashtag = $tweets->hashtag();

header('Content-type: application/json');

echo $json = (isset($_GET['hashtag'])) ? $hashtag : $timeline;
$tweets = new Tweets();
$tweets->render();
9 changes: 9 additions & 0 deletions vendor/Tweets/Tweets.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,13 @@ public function hashtag() {

return json_encode($data);
}

public function render() {
$timeline = $this->user_timeline();
$hashtag = $this->hashtag();

header('Content-type: application/json');

echo $json = (isset($_GET['hashtag'])) ? $hashtag : $timeline;
}
}

0 comments on commit 467fe39

Please sign in to comment.