Completed
Push — master ( cf0c7a...520b04 )
by Jacob
03:43
created

TwitterCollector   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 22
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getMissingTweets() 0 5 1
A getRow() 0 5 1
A getTweetByFields() 0 5 1
1
<?
0 ignored issues
show
Security Best Practice introduced by
It is not recommend to use PHP's short opening tag <?, better use <?php, or <?= in case of outputting.

Short opening tags are disabled in PHP’s default configuration. In such a case, all content of this file is output verbatim to the browser without being parsed, or executed.

As a precaution to avoid these problems better use the long opening tag <?php.

Loading history...
2
3
Loader::load('collector', 'Collector');
4
5
final class TwitterCollector extends Collector
6
{
7
8
	public static function getMissingTweets()
9
	{
10
		$query = "SELECT `id`, `date` FROM `jpemeric_stream`.`twitter` WHERE `id` NOT IN (SELECT `type_id` FROM `jpemeric_stream`.`post` WHERE `type` = 'twitter') && (`is_reply` = '0' || `retweets` > '0' || `favorites` > '0')";
11
		return self::run_query($query);
12
	}
13
14
	public static function getRow($id)
15
	{
16
		$query = "SELECT * FROM `jpemeric_stream`.`twitter` WHERE `id` = '{$id}'";
17
		return self::run_row_query($query);
18
	}
19
20
	public static function getTweetByFields($date, $text)
21
	{
22
		$query = "SELECT * FROM `jpemeric_stream`.`twitter` WHERE `date` = '{$date}' && `text` = '{$text}' LIMIT 1";
23
		return self::run_row_query($query);
24
	}
25
26
}