Browse files

Clean up whitespace using Eclipse autoformatting [ci skip]

  • Loading branch information...
1 parent 4fc30d1 commit bb647d94b2398be79414cb81d86b06d494fe157d @ginatrapani ginatrapani committed Oct 19, 2012
View
22 tests/TestOfPostAPIController.php
@@ -1046,7 +1046,7 @@ public function testPostRepliesInRange() {
$this->assertTrue(strtotime($post->created_at) >= strtotime($_GET['from']));
$this->assertTrue(strtotime($post->created_at) < strtotime($_GET['until']));
}
-
+
$this->assertEqual(sizeof($output), 2);
$this->assertEqual($output[0]->id, 131);
$this->assertEqual($output[1]->id, 133);
@@ -1100,7 +1100,7 @@ public function testPostRepliesInRange() {
$installer_dao = DAOFactory::getDAO('InstallerDAO');
$this->assertTrue(array_search($prefix . "posts", $installer_dao->getTables()) !== false);
}
-
+
public function testRelatedPosts() {
$_GET['type'] = 'related_posts';
$_GET['post_id'] = 41;
@@ -1713,7 +1713,7 @@ public function testUserMentions() {
$this->assertTrue(array_search($prefix . "posts", $installer_dao->getTables()) !== false);
}
- public function testUserMentionsInRange() {
+ public function testUserMentionsInRange() {
$_GET['type'] = 'user_mentions_in_range';
$_GET['user_id'] = 18;
$_GET['from'] = '2006-03-01 00:00:00';
@@ -1843,7 +1843,7 @@ public function testUserMentionsInRange() {
$output = json_decode($controller->go());
$this->assertEqual(sizeof($output), 2);
- // test trim user
+ // test trim user
unset($_GET['include_entities']);
$_GET['trim_user'] = true;
$controller = new PostAPIController(true);
@@ -2105,7 +2105,7 @@ public function testUserRepliesInRange() {
}
$this->assertEqual(sizeof($output), 2);
-
+
// test order_by
$_GET['order_by'] = 'date';
$_GET['direction'] = 'DESC';
@@ -2221,7 +2221,7 @@ public function testUserRepliesInRange() {
$installer_dao = DAOFactory::getDAO('InstallerDAO');
$this->assertTrue(array_search($prefix . "posts", $installer_dao->getTables()) !== false);
}
-
+
public function testUserQuestions() {
$_GET['type'] = 'user_questions';
$_GET['user_id'] = 20;
@@ -2378,9 +2378,9 @@ public function testUserQuestions() {
$this->assertTrue(array_search($prefix . "posts", $installer_dao->getTables()) !== false);
}
- public function testUserQuestionsInRange() {
+ public function testUserQuestionsInRange() {
$_GET['type'] = 'user_questions_in_range';
- $_GET['user_id'] = 20;
+ $_GET['user_id'] = 20;
$_GET['from'] = '2006-03-01 00:00:00';
$_GET['until'] = '2006-03-02 00:59:59';
$controller = new PostAPIController(true);
@@ -2397,7 +2397,7 @@ public function testUserQuestionsInRange() {
* SET timezone statement in PDODAO::connect function
*/
$this->assertTrue(strtotime($post->created_at) >= strtotime($_GET['from']));
- $this->assertTrue(strtotime($post->created_at) < strtotime($_GET['until']));
+ $this->assertTrue(strtotime($post->created_at) < strtotime($_GET['until']));
}
// test order_by
@@ -2513,8 +2513,8 @@ public function testUserQuestionsInRange() {
}
$installer_dao = DAOFactory::getDAO('InstallerDAO');
$this->assertTrue(array_search($prefix . "posts", $installer_dao->getTables()) !== false);
- }
-
+ }
+
public function testUserQuestionsProtectedOnNetwork() {
$_GET['type'] = 'user_questions';
$_GET['user_id'] = 24;
View
42 tests/TestOfPostMySQLDAO.php
@@ -423,22 +423,22 @@ public function testGetAllQuestionPosts() {
/**
* Test getAllQuestionPostosInRange
*/
- public function testgetAllQuestionPostsInRange() {
+ public function testgetAllQuestionPostsInRange() {
$builders = array();
//Add a question
$post_builder = FixtureBuilder::build('posts', array('author_user_id'=>'13', 'author_username'=>'ev',
'post_text'=>'I need a new cell phone. Not this http://bit.ly/blah or this http://bit.ly/blah2 '.
'What should I buy?', 'network'=>'twitter', 'in_reply_to_post_id'=>0,
'pub_date'=>'2006-02-01 00:05:00'));
-
+
array_push($builders, $post_builder);
$post_key = $post_builder->columns['last_insert_id'];
$builders[] = FixtureBuilder::build('links', array('post_key'=>$post_key, 'url'=>'http://bit.ly/blah'));
$builders[] = FixtureBuilder::build('links', array('post_key'=>$post_key, 'url'=>'http://bit.ly/blah2'));
$dao = new PostMySQLDAO();
- $questions = $dao->getAllQuestionPostsInRange('13', 'twitter', '10', $from = '2006-02-01 00:04:00',
+ $questions = $dao->getAllQuestionPostsInRange('13', 'twitter', '10', $from = '2006-02-01 00:04:00',
$until= '2006-02-02 00:10:00');
$this->debug('Questions: ' . $questions);
@@ -452,10 +452,10 @@ public function testgetAllQuestionPostsInRange() {
//Add another question
$builder[] = FixtureBuilder::build('posts', array('author_user_id'=>13, 'author_username'=>'ev',
- 'post_text'=>'Best sushi in NY? downtown', 'network'=>'twitter', 'in_reply_to_post_id'=>0,
+ 'post_text'=>'Best sushi in NY? downtown', 'network'=>'twitter', 'in_reply_to_post_id'=>0,
'pub_date'=>'2006-02-01 00:06:00'));
- $questions = $dao->getAllQuestionPostsInRange('13', 'twitter', '10', $from = '2006-02-01 00:04:00',
+ $questions = $dao->getAllQuestionPostsInRange('13', 'twitter', '10', $from = '2006-02-01 00:04:00',
$until= '2006-02-01 00:10:00');
$this->assertEqual(sizeof($questions), 2);
$this->assertEqual($questions[0]->post_text, 'Best sushi in NY? downtown' );
@@ -466,29 +466,29 @@ public function testgetAllQuestionPostsInRange() {
$builder[] = FixtureBuilder::build('posts', array('author_user_id'=>13, 'author_username'=>'ev',
'post_text'=>'Love this video: http://www.youtube.com/watch?v=PQu-zrE-k5s', 'network'=>'twitter',
'in_reply_to_post_id'=>0, 'pub_date'=>'2006-02-01 00:07:00'));
- $questions = $dao->getAllQuestionPostsInRange('13', 'twitter', '10', $from = '2006-02-01 00:04:00',
+ $questions = $dao->getAllQuestionPostsInRange('13', 'twitter', '10', $from = '2006-02-01 00:04:00',
$until= '2006-02-01 00:10:00');
$this->assertEqual(sizeof($questions), 2);
-
+
// test ascending order
$posts = $dao->getAllQuestionPostsInRange('13', 'twitter', '10', $from = '2006-02-01 00:01:00',
$until = '2006-02-01 00:10:00',$page=1, $order_by = 'pub_date', $direction = 'ASC');
$this->assertEqual(sizeof($posts), 2);
- foreach($posts as $post) {
+ foreach($posts as $post) {
$this->assertTrue(strtotime($post->pub_date) >= $date);
$date = strtotime($post->pub_date);
}
-
+
// test range with no posts
- $questions = $dao->getAllQuestionPostsInRange('13', 'twitter', '10', $from = '2006-02-01 00:10:00',
+ $questions = $dao->getAllQuestionPostsInRange('13', 'twitter', '10', $from = '2006-02-01 00:10:00',
$until= '2006-02-01 00:15:00');
$this->assertEqual(sizeof($questions), 0);
// test from greater than until
- $questions = $dao->getAllQuestionPostsInRange('13', 'twitter', '10', $from = '2006-02-01 00:10:00',
+ $questions = $dao->getAllQuestionPostsInRange('13', 'twitter', '10', $from = '2006-02-01 00:10:00',
$until= '2006-01-01 00:15:00');
- $this->assertEqual(sizeof($questions), 0);
+ $this->assertEqual(sizeof($questions), 0);
}
/**
@@ -627,7 +627,7 @@ public function testgetAllRepliesInRange() {
$dao = new PostMySQLDAO();
$posts = $dao->getAllRepliesInRange(23, 'twitter', 200, $from = '2006-02-28 23:50:00',
$until = '2006-03-02 00:30:59', $order_by="pub_date", $direction="DESC");
- $this->assertEqual(sizeof($posts),2);
+ $this->assertEqual(sizeof($posts),2);
// test date ordering and time range check
$date = strtotime($posts[0]->pub_date);
foreach($posts as $post) {
@@ -640,7 +640,7 @@ public function testgetAllRepliesInRange() {
// test ascending order
$posts = $dao->getAllRepliesInRange(13, 'twitter', 500,$from = '2006-02-28 23:50:00',
- $until = '2006-03-01 00:30:59', $order_by="pub_date", $direction="ASC");
+ $until = '2006-03-01 00:30:59', $order_by="pub_date", $direction="ASC");
$date = strtotime($posts[0]->pub_date);
foreach($posts as $post) {
@@ -733,19 +733,19 @@ public function testGetAllMentions() {
*/
public function testgetAllMentionsInRange() {
$dao = new PostMySQLDAO();
- $mentions = $dao->getAllMentionsInRange("ev", $count = 200, $network = 'twitter', $from = '2006-03-01 00:00:00',
+ $mentions = $dao->getAllMentionsInRange("ev", $count = 200, $network = 'twitter', $from = '2006-03-01 00:00:00',
$until = '2006-03-01 01:00:00', $page=1, $public=false, $include_rts = true, $order_by="pub_date", $direction="DESC");
-
+
$this->assertEqual($mentions[0]->post_text, "Hey @ev and @jack should fix Twitter - post 9");
- $this->assertEqual($mentions[2]->post_text, "Hey @ev and @jack should fix Twitter - post 7");
-
+ $this->assertEqual($mentions[2]->post_text, "Hey @ev and @jack should fix Twitter - post 7");
+
$mentions = $dao->getAllMentionsInRange("jack", $count = 200, $network = 'twitter', $from = '2006-03-01 00:00:00',
$until = '2006-03-01 01:00:00', $page=1, $public=false, $include_rts = true, $order_by="pub_date", $direction="DESC");
$this->assertEqual(sizeof($mentions), 10);
- // test ascending order
+ // test ascending order
$posts = $dao->getAllMentionsInRange("jack", $count = 200, $network = 'twitter', $from = '2006-02-28 23:59:00',
$until = '2006-03-01 01:00:00', $page=1, $public=false, $include_rts = true, $order_by="pub_date", $direction="ASC");
@@ -1126,7 +1126,7 @@ public function testGetRepliesToPost() {
/**
* Test getRepliesToPostInRange
*/
- public function testgetRepliesToPostInRange() {
+ public function testgetRepliesToPostInRange() {
$dao = new PostMySQLDAO();
// Default Sorting
$posts = $dao->getRepliesToPostInRange('41', 'twitter', $from = '2006-03-01 00:00:00',$until = '2006-03-02 23:30:59',
@@ -1138,7 +1138,7 @@ public function testgetRepliesToPostInRange() {
$this->assertEqual($posts[1]->location,'Chennai, Tamil Nadu, India');
$this->assertEqual($posts[1]->post_id, '132', "post ID");
-
+
// test date ordering and time range check
$date = strtotime($posts[0]->pub_date);
foreach($posts as $post) {
View
28 webapp/_lib/controller/class.PostAPIController.php
@@ -388,7 +388,7 @@ public function control() {
}
break;
-
+
/*
* Gets replies to a post within a date range.
*
@@ -409,8 +409,8 @@ public function control() {
$this->unit, $this->is_public, $this->count, $this->page);
}
break;
-
- /*
+
+ /*
* Get posts related to a post (replies to it, retweets of it).
*
* Required arguments: post_id
@@ -508,7 +508,7 @@ public function control() {
$this->page, $this->is_public, $this->include_rts, $this->order_by, $this->direction);
break;
-
+
/*
* Gets posts a user is mentioned in.within a date range
*
@@ -517,17 +517,17 @@ public function control() {
* Optional arguments: network, count, page, include_rts, include_entities, include_replies, trim_user
*/
case 'user_mentions_in_range':
- if (is_null($this->from) || is_null($this->until)) {
+ if (is_null($this->from) || is_null($this->until)) {
$m = 'A request of type ' . $this->type . ' requires valid from and until parameters to be ';
$m .= 'specified.';
throw new RequiredArgumentMissingException($m);
- } else {
- $data = $this->post_dao->getAllMentionsInRange($this->user->username, $this->count, $this->network,
- $this->from, $this->until, $this->page, $this->is_public, $this->include_rts,$this->order_by,
- $this->direction);
+ } else {
+ $data = $this->post_dao->getAllMentionsInRange($this->user->username, $this->count, $this->network,
+ $this->from, $this->until, $this->page, $this->is_public, $this->include_rts,$this->order_by,
+ $this->direction);
}
break;
-
+
/*
* Gets question posts a user has made.
*
@@ -552,12 +552,12 @@ public function control() {
* trim_user
*
* Docs: http://thinkupapp.com/docs/userguide/api/posts/user_questions.html
- */
+ */
case 'user_questions_in_range':
$data = $this->post_dao->getAllQuestionPostsInRange($this->user->user_id, $this->network, $this->count, $this->from, $this->until,
$this->page, $this->order_by, $this->direction, $this->is_public);
break;
-
+
/*
* Gets replies to a user.
*
@@ -572,7 +572,7 @@ public function control() {
$data = $this->post_dao->getAllReplies($this->user->user_id, $this->network, $this->count,
$this->page, $this->order_by, $this->direction, $this->is_public);
break;
-
+
/*
* Gets replies to a user within a date range.
*
@@ -587,7 +587,7 @@ public function control() {
$data = $this->post_dao->getAllRepliesInRange($this->user->user_id, $this->network, $this->count,$this->from, $this->until,
$this->page, $this->order_by, $this->direction, $this->is_public);
break;
-
+
/*
* Generate an error because the API call type was not recognized.
*
View
28 webapp/_lib/dao/class.PostMySQLDAO.php
@@ -207,7 +207,7 @@ public function getRepliesToPost($post_id, $network, $order_by = 'default', $uni
return $replies;
}
- public function getRepliesToPostInRange($post_id, $network, $from, $until, $order_by = 'default', $unit = 'km', $is_public = false,
+ public function getRepliesToPostInRange($post_id, $network, $from, $until, $order_by = 'default', $unit = 'km', $is_public = false,
$count = 350, $page = 1) {
$start_on_record = ($page - 1) * $count;
@@ -236,7 +236,7 @@ public function getRepliesToPostInRange($post_id, $network, $from, $until, $orde
':user_network'=>($network == 'facebook page') ? 'facebook' : $network,
':from' => $from,
':until' => $until
-
+
);
@@ -281,7 +281,7 @@ public function getRepliesToPostInRange($post_id, $network, $from, $until, $orde
}
return $replies;
}
-
+
public function getRepliesToPostIterator($post_id, $network, $order_by = 'default', $unit = 'km',
$is_public = false, $count = 350, $page = 1) {
$start_on_record = ($page - 1) * $count;
@@ -1011,8 +1011,8 @@ public function getAllQuestionPostsInRange($author_id, $network, $count, $from,
':format1'=>"\\?$",
':format2'=>"%\\? %",
':from' => $from,
- ':until' => $until
-
+ ':until' => $until
+
);
if ($this->profiler_enabled) Profiler::setDAOMethod(__METHOD__);
$ps = $this->execute($q, $vars);
@@ -1043,8 +1043,8 @@ public function getAllQuestionPostsInRange($author_id, $network, $count, $from,
}
}
return $posts;
- }
-
+ }
+
/**
* Get all posts by a given user with configurable order by field and direction
* @param int $author_id
@@ -1451,9 +1451,9 @@ private function getMentions($author_username, $count, $network, $iterator, $pag
return $posts;
}
- public function getAllMentionsInRange($author_username, $count, $network = "twitter", $from, $until, $page=1,
- $public=false, $include_rts = true, $order_by = 'pub_date', $direction = 'DESC') {
- return $this->getMentionsInRange($author_username, $count, $network, $from, $until, $iterator = false, $page,
+ public function getAllMentionsInRange($author_username, $count, $network = "twitter", $from, $until, $page=1,
+ $public=false, $include_rts = true, $order_by = 'pub_date', $direction = 'DESC') {
+ return $this->getMentionsInRange($author_username, $count, $network, $from, $until, $iterator = false, $page,
$public, $include_rts, $order_by, $direction);
}
@@ -1470,7 +1470,7 @@ private function getMentionsInRange($author_username, $count, $network, $from, $
$q .= "FROM #prefix#posts AS p ";
$q .= "INNER JOIN #prefix#users AS u ON p.author_user_id = u.user_id ";
$q .= "WHERE p.network = :network AND pub_date BETWEEN :from AND :until ";
-
+
if ( strlen($author_username) > PostMySQLDAO::FULLTEXT_CHAR_MINIMUM ) {
$q .= "AND MATCH (`post_text`) AGAINST(:author_username IN BOOLEAN MODE) ";
} else {
@@ -1580,7 +1580,7 @@ public function getAllReplies($user_id, $network, $count, $page = 1, $order_by =
return $posts;
}
- public function getAllRepliesInRange($user_id, $network, $count, $from, $until,$page = 1, $order_by = 'pub_date', $direction = 'DESC',
+ public function getAllRepliesInRange($user_id, $network, $count, $from, $until,$page = 1, $order_by = 'pub_date', $direction = 'DESC',
$is_public = false) {
$start_on_record = ($page - 1) * $count;
@@ -1602,7 +1602,7 @@ public function getAllRepliesInRange($user_id, $network, $count, $from, $until,$
':from' => $from,
':until' => $until
);
-
+
if ($this->profiler_enabled) Profiler::setDAOMethod(__METHOD__);
$ps = $this->execute($q, $vars);
$all_post_rows = $this->getDataRowsAsArrays($ps);
@@ -1634,7 +1634,7 @@ public function getAllRepliesInRange($user_id, $network, $count, $from, $until,$
}
return $posts;
}
-
+
public function getMostRepliedToPosts($user_id, $network, $count, $page=1, $is_public = false) {
return $this->getAllPostsByUserID($user_id, $network, $count, "reply_count_cache", "DESC", true, $page,
$iterator = false, $is_public);
View
8 webapp/_lib/dao/interface.PostDAO.php
@@ -66,7 +66,7 @@ public function getRepliesToPost($post_id, $network, $order_by = 'default', $uni
*/
public function getRepliesToPostInRange($post_id, $network, $from, $until, $order_by = 'default', $unit = 'km', $is_public = false,
$count = 350, $page = 1);
-
+
/**
* Get replies Iterator to a post
* @param str $post_id
@@ -375,7 +375,7 @@ public function getAllMentions($author_username, $count, $network = "twitter", $
*/
public function getAllMentionsInRange($author_username, $count, $network = "twitter", $from, $until, $page=1, $public=false,
$include_rts = true, $order_by = 'pub_date', $direction = 'DESC');
-
+
/**
* Get all replies to a given user ID
* @param int $user_id
@@ -391,7 +391,7 @@ public function getAllMentionsInRange($author_username, $count, $network = "twit
*/
public function getAllReplies($user_id, $network, $count, $page = 1, $order_by = 'pub_date', $direction = 'DESC',
$is_public = false);
-
+
/**
* Get all replies to a given user ID on a given time frame.
* @param int $user_id
@@ -407,7 +407,7 @@ public function getAllReplies($user_id, $network, $count, $page = 1, $order_by =
*/
public function getAllRepliesInRange($user_id, $network, $count, $from, $until, $page = 1, $order_by = 'pub_date', $direction = 'DESC',
$is_public = false);
-
+
/**
* Get posts by a user ordered by reply count desc
* @param int $user_id

0 comments on commit bb647d9

Please sign in to comment.