Completed
Push — master ( ce03f9...989695 )
by Jacob
04:19
created
src/Domain/Comment/Comment/CommentRepositoryInterface.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,5 +4,5 @@
 block discarded – undo
4 4
 
5 5
 interface CommentRepositoryInterface
6 6
 {
7
-    public function getActiveCommentsBySite($site, $limit = null, $offset= 0);
7
+	public function getActiveCommentsBySite($site, $limit = null, $offset= 0);
8 8
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,5 +4,5 @@
 block discarded – undo
4 4
 
5 5
 interface CommentRepositoryInterface
6 6
 {
7
-    public function getActiveCommentsBySite($site, $limit = null, $offset= 0);
7
+    public function getActiveCommentsBySite($site, $limit = null, $offset = 0);
8 8
 }
Please login to merge, or discard this patch.
script/cron/generate-rss-feeds.php 3 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
  * @param string $folder
17 17
  * @return boolean
18 18
  */
19
-$buildFeed = function (Feed $feed, $folder, $name = 'rss') {
19
+$buildFeed = function(Feed $feed, $folder, $name = 'rss') {
20 20
     $tempFeed = __DIR__ . "/../../public/{$folder}/{$name}-new.xml";
21 21
     $finalFeed = __DIR__ . "/../../public/{$folder}/{$name}.xml";
22 22
 
Please login to merge, or discard this patch.
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -17,14 +17,14 @@  discard block
 block discarded – undo
17 17
  * @return boolean
18 18
  */
19 19
 $buildFeed = function (Feed $feed, $folder, $name = 'rss') {
20
-    $tempFeed = __DIR__ . "/../../public/{$folder}/{$name}-new.xml";
21
-    $finalFeed = __DIR__ . "/../../public/{$folder}/{$name}.xml";
20
+	$tempFeed = __DIR__ . "/../../public/{$folder}/{$name}-new.xml";
21
+	$finalFeed = __DIR__ . "/../../public/{$folder}/{$name}.xml";
22 22
 
23
-    $feedHandle = fopen($tempFeed, 'w');
24
-    fwrite($feedHandle, $feed->render());
25
-    fclose($feedHandle);
23
+	$feedHandle = fopen($tempFeed, 'w');
24
+	fwrite($feedHandle, $feed->render());
25
+	fclose($feedHandle);
26 26
 
27
-    rename($tempFeed, $finalFeed);
27
+	rename($tempFeed, $finalFeed);
28 28
 };
29 29
 
30 30
 
@@ -43,34 +43,34 @@  discard block
 block discarded – undo
43 43
 $activeBlogPosts = $blogPostRepository->getActivePosts();
44 44
 
45 45
 foreach ($activeBlogPosts as $blogPost) {
46
-    $blogPostItem = new Item();
47
-
48
-    $blogPostItem->title($blogPost['title']);
49
-
50
-    $url = "http://blog.jacobemerick.com/{$blogPost['category']}/{$blogPost['path']}/";
51
-    $blogPostItem->url($url);
52
-    $blogPostItem->guid($url, true);
53
-
54
-    $description = $blogPost['body'];
55
-    $description = strip_tags($description);
56
-    $description = strtok($description, "\n");
57
-    if (strlen($description) > 250) {
58
-        $description = wordwrap($description, 250);
59
-        $description = strtok($description, "\n");
60
-        if (substr($description, -1) != '.') {
61
-            $description .= '…';
62
-        }
63
-    }
64
-    $description = html_entity_decode($description);
65
-    $blogPostItem->description($description);
66
-
67
-    $categoryUrl = "http://blog.jacobemerick.com/{$blogPost['category']}/";
68
-    $blogPostItem->category($blogPost['category'], $categoryUrl);
69
-
70
-    $pubDate = new DateTime($blogPost['date']);
71
-    $blogPostItem->pubDate($pubDate->getTimestamp());
72
-
73
-    $blogPostItem->appendTo($blogPostChannel);
46
+	$blogPostItem = new Item();
47
+
48
+	$blogPostItem->title($blogPost['title']);
49
+
50
+	$url = "http://blog.jacobemerick.com/{$blogPost['category']}/{$blogPost['path']}/";
51
+	$blogPostItem->url($url);
52
+	$blogPostItem->guid($url, true);
53
+
54
+	$description = $blogPost['body'];
55
+	$description = strip_tags($description);
56
+	$description = strtok($description, "\n");
57
+	if (strlen($description) > 250) {
58
+		$description = wordwrap($description, 250);
59
+		$description = strtok($description, "\n");
60
+		if (substr($description, -1) != '.') {
61
+			$description .= '…';
62
+		}
63
+	}
64
+	$description = html_entity_decode($description);
65
+	$blogPostItem->description($description);
66
+
67
+	$categoryUrl = "http://blog.jacobemerick.com/{$blogPost['category']}/";
68
+	$blogPostItem->category($blogPost['category'], $categoryUrl);
69
+
70
+	$pubDate = new DateTime($blogPost['date']);
71
+	$blogPostItem->pubDate($pubDate->getTimestamp());
72
+
73
+	$blogPostItem->appendTo($blogPostChannel);
74 74
 }
75 75
 
76 76
 $buildFeed($blogPostFeed, 'blog');
@@ -88,33 +88,33 @@  discard block
 block discarded – undo
88 88
 $activeBlogComments = $commentRepository->getActiveCommentsBySite('blog');
89 89
 
90 90
 foreach ($activeBlogComments as $blogComment) {
91
-    $blogCommentItem = new Item();
92
-
93
-    $blogCommentItem->title("Comment on '{$blogComment['title']}' from {$blogComment['name']}");
94
-
95
-    $url = "http://blog.jacobemerick.com/{$blogComment['category']}/{$blogComment['path']}/";
96
-    $url .= "#comment-{$blogComment['id']}";
97
-    $blogCommentItem->url($url);
98
-    $blogCommentItem->guid($url, true);
99
-
100
-    $description = $blogComment['body'];
101
-    $description = strip_tags($description);
102
-    $description = strtok($description, "\n");
103
-    if (strlen($description) > 250) {
104
-        $description = wordwrap($description, 250);
105
-        $description = strtok($description, "\n");
106
-        if (substr($description, -1) != '.') {
107
-            $description .= '…';
108
-        }
109
-    }
110
-    $description = html_entity_decode($description);
111
-    $description = trim($description);
112
-    $blogCommentItem->description($description);
113
-
114
-    $pubDate = new DateTime($blogComment['date']);
115
-    $blogCommentItem->pubDate($pubDate->getTimestamp());
116
-
117
-    $blogCommentItem->appendTo($blogCommentChannel);
91
+	$blogCommentItem = new Item();
92
+
93
+	$blogCommentItem->title("Comment on '{$blogComment['title']}' from {$blogComment['name']}");
94
+
95
+	$url = "http://blog.jacobemerick.com/{$blogComment['category']}/{$blogComment['path']}/";
96
+	$url .= "#comment-{$blogComment['id']}";
97
+	$blogCommentItem->url($url);
98
+	$blogCommentItem->guid($url, true);
99
+
100
+	$description = $blogComment['body'];
101
+	$description = strip_tags($description);
102
+	$description = strtok($description, "\n");
103
+	if (strlen($description) > 250) {
104
+		$description = wordwrap($description, 250);
105
+		$description = strtok($description, "\n");
106
+		if (substr($description, -1) != '.') {
107
+			$description .= '…';
108
+		}
109
+	}
110
+	$description = html_entity_decode($description);
111
+	$description = trim($description);
112
+	$blogCommentItem->description($description);
113
+
114
+	$pubDate = new DateTime($blogComment['date']);
115
+	$blogCommentItem->pubDate($pubDate->getTimestamp());
116
+
117
+	$blogCommentItem->appendTo($blogCommentChannel);
118 118
 }
119 119
 
120 120
 $buildFeed($blogCommentFeed, 'blog', 'rss-comments');
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,6 @@
 block discarded – undo
3 3
 require_once __DIR__ . '/../index.php';
4 4
 
5 5
 use Github\Client;
6
-
7 6
 use Jacobemerick\Web\Domain\Stream\Changelog\MysqlChangelogRepository as ChangelogRepository;
8 7
 
9 8
 $client = new Client();
Please login to merge, or discard this patch.
src/Domain/Stream/Twitter/MysqlTwitterRepository.php 1 patch
Indentation   +100 added lines, -100 removed lines patch added patch discarded remove patch
@@ -8,133 +8,133 @@
 block discarded – undo
8 8
 class MysqlTwitterRepository implements TwitterRepositoryInterface
9 9
 {
10 10
 
11
-    /** @var  ConnectionLocator */
12
-    protected $connections;
13
-
14
-    /**
15
-     * @param ConnectonLocator $connections
16
-     */
17
-    public function __construct(ConnectionLocator $connections)
18
-    {
19
-        $this->connections = $connections;
20
-    }
21
-
22
-    /**
23
-     * @param integer $id
24
-     *
25
-     * @return array|false
26
-     */
27
-    public function getTwitterById($id)
28
-    {
29
-        $query = "
11
+	/** @var  ConnectionLocator */
12
+	protected $connections;
13
+
14
+	/**
15
+	 * @param ConnectonLocator $connections
16
+	 */
17
+	public function __construct(ConnectionLocator $connections)
18
+	{
19
+		$this->connections = $connections;
20
+	}
21
+
22
+	/**
23
+	 * @param integer $id
24
+	 *
25
+	 * @return array|false
26
+	 */
27
+	public function getTwitterById($id)
28
+	{
29
+		$query = "
30 30
             SELECT *
31 31
             FROM `jpemeric_stream`.`twitter`
32 32
             WHERE `id` = :id
33 33
             LIMIT 1";
34
-        $bindings = [
35
-            'id' => $id,
36
-        ];
37
-
38
-        return $this
39
-            ->connections
40
-            ->getRead()
41
-            ->fetchOne($query, $bindings);
42
-    }
43
-
44
-    public function getTwitterByTweetId($tweetId)
45
-    {
46
-        $query = "
34
+		$bindings = [
35
+			'id' => $id,
36
+		];
37
+
38
+		return $this
39
+			->connections
40
+			->getRead()
41
+			->fetchOne($query, $bindings);
42
+	}
43
+
44
+	public function getTwitterByTweetId($tweetId)
45
+	{
46
+		$query = "
47 47
             SELECT `id`, `tweet_id`, `datetime`, `metadata`
48 48
             FROM `jpemeric_stream`.`twitter2`
49 49
             WHERE `tweet_id` = :tweet_id
50 50
             LIMIT 1";
51 51
 
52
-        $bindings = [
53
-            'tweet_id' => $tweetId,
54
-        ];
55
-
56
-        return $this
57
-            ->connections
58
-            ->getRead()
59
-            ->fetchOne($query, $bindings);
60
-    }
61
-
62
-    /**
63
-     * @param DateTime $date
64
-     * @param string   $text
65
-     *
66
-     * @return array|false
67
-     */
68
-    public function getTwitterByFields(DateTime $date, $text)
69
-    {
70
-        $query = "
52
+		$bindings = [
53
+			'tweet_id' => $tweetId,
54
+		];
55
+
56
+		return $this
57
+			->connections
58
+			->getRead()
59
+			->fetchOne($query, $bindings);
60
+	}
61
+
62
+	/**
63
+	 * @param DateTime $date
64
+	 * @param string   $text
65
+	 *
66
+	 * @return array|false
67
+	 */
68
+	public function getTwitterByFields(DateTime $date, $text)
69
+	{
70
+		$query = "
71 71
             SELECT *
72 72
             FROM `jpemeric_stream`.`twitter`
73 73
             WHERE `date` = :date AND `text` = :text
74 74
             LIMIT 1";
75
-        $bindings = [
76
-            'date' => $date->format('Y-m-d H:i:s'),
77
-            'text' => $text,
78
-        ];
79
-
80
-        return $this
81
-            ->connections
82
-            ->getRead()
83
-            ->fetchOne($query, $bindings);
84
-    }
85
-
86
-    /**
87
-     * @return array|false
88
-     */
89
-    public function getUnmappedTwitters()
90
-    {
91
-        $query = "
75
+		$bindings = [
76
+			'date' => $date->format('Y-m-d H:i:s'),
77
+			'text' => $text,
78
+		];
79
+
80
+		return $this
81
+			->connections
82
+			->getRead()
83
+			->fetchOne($query, $bindings);
84
+	}
85
+
86
+	/**
87
+	 * @return array|false
88
+	 */
89
+	public function getUnmappedTwitters()
90
+	{
91
+		$query = "
92 92
             SELECT `id`, `date`
93 93
             FROM `jpemeric_stream`.`twitter`
94 94
             LEFT JOIN `jpemeric_stream`.`post`
95 95
             ON `post`.`type_id` = `twitter`.`id` AND `post`.`id` IS NULL";
96 96
 
97
-        return $this
98
-            ->connections
99
-            ->getRead()
100
-            ->fetchAll($query);
101
-    }
97
+		return $this
98
+			->connections
99
+			->getRead()
100
+			->fetchAll($query);
101
+	}
102 102
 
103
-    public function insertTweet($tweetId, DateTime $datetime, array $metadata)
104
-    {
105
-        $query = "
103
+	public function insertTweet($tweetId, DateTime $datetime, array $metadata)
104
+	{
105
+		$query = "
106 106
             INSERT INTO `jpemeric_stream`.`twitter2`
107 107
                 (`tweet_id`, `datetime`, `metadata`)
108 108
             VALUES
109 109
                 (:tweet_id, :datetime, :metadata)";
110 110
 
111
-        $bindings = [
112
-            'tweet_id' => $tweetId,
113
-            'datetime' => $datetime->format('Y-m-d H:i:s'),
114
-            'metadata' => json_encode($metadata),
115
-        ];
116
-
117
-        return $this
118
-            ->connections
119
-            ->getWrite()
120
-            ->perform($query, $bindings);
121
-    }
122
-
123
-    public function updateTweetMetadata($tweetId, array $metadata)
124
-    {
125
-        $query = "
111
+		$bindings = [
112
+			'tweet_id' => $tweetId,
113
+			'datetime' => $datetime->format('Y-m-d H:i:s'),
114
+			'metadata' => json_encode($metadata),
115
+		];
116
+
117
+		return $this
118
+			->connections
119
+			->getWrite()
120
+			->perform($query, $bindings);
121
+	}
122
+
123
+	public function updateTweetMetadata($tweetId, array $metadata)
124
+	{
125
+		$query = "
126 126
             UPDATE `jpemeric_stream`.`twitter2`
127 127
             SET `metadata` = :metadata
128 128
             WHERE `tweet_id` = :tweet_id";
129 129
 
130
-        $bindings = [
131
-            'metadata' => json_encode($metadata),
132
-            'tweet_id' => $tweetId,
133
-        ];
130
+		$bindings = [
131
+			'metadata' => json_encode($metadata),
132
+			'tweet_id' => $tweetId,
133
+		];
134 134
 
135
-        return $this
136
-            ->connections
137
-            ->getWrite()
138
-            ->perform($query, $bindings);
139
-    }
135
+		return $this
136
+			->connections
137
+			->getWrite()
138
+			->perform($query, $bindings);
139
+	}
140 140
 }
Please login to merge, or discard this patch.
src/Domain/Stream/BlogComment/MysqlBlogCommentRepository.php 1 patch
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -8,80 +8,80 @@
 block discarded – undo
8 8
 class MysqlBlogCommentRepository implements BlogCommentRepositoryInterface
9 9
 {
10 10
 
11
-    /** @var  ConnectionLocator */
12
-    protected $connections;
11
+	/** @var  ConnectionLocator */
12
+	protected $connections;
13 13
 
14
-    /**
15
-     * @param ConnectonLocator $connections
16
-     */
17
-    public function __construct(ConnectionLocator $connections)
18
-    {
19
-        $this->connections = $connections;
20
-    }
14
+	/**
15
+	 * @param ConnectonLocator $connections
16
+	 */
17
+	public function __construct(ConnectionLocator $connections)
18
+	{
19
+		$this->connections = $connections;
20
+	}
21 21
 
22
-    /**
23
-     * @param integer $limit
24
-     * @param integer $offset
25
-     *
26
-     * @return array|false
27
-     */
28
-    public function getBlogComments($limit = null, $offset = 0)
29
-    {
30
-        $query = "
22
+	/**
23
+	 * @param integer $limit
24
+	 * @param integer $offset
25
+	 *
26
+	 * @return array|false
27
+	 */
28
+	public function getBlogComments($limit = null, $offset = 0)
29
+	{
30
+		$query = "
31 31
             SELECT `id`, `permalink`, `datetime`
32 32
             FROM `jpemeric_stream`.`blog_comment`
33 33
             ORDER BY `datetime` DESC";
34
-        if (!is_null($limit)) {
35
-            $query .= "
34
+		if (!is_null($limit)) {
35
+			$query .= "
36 36
             LIMIT {$offset}, {$limit}";
37
-        }
37
+		}
38 38
 
39
-        return $this
40
-            ->connections
41
-            ->getRead()
42
-            ->fetchAll($query);
43
-    }
39
+		return $this
40
+			->connections
41
+			->getRead()
42
+			->fetchAll($query);
43
+	}
44 44
 
45
-    /**
46
-     * @param string $permalink
47
-     *
48
-     * @return array|false
49
-     */
50
-    public function getBlogCommentByPermalink($permalink)
51
-    {
52
-        $query = "
45
+	/**
46
+	 * @param string $permalink
47
+	 *
48
+	 * @return array|false
49
+	 */
50
+	public function getBlogCommentByPermalink($permalink)
51
+	{
52
+		$query = "
53 53
             SELECT *
54 54
             FROM `jpemeric_stream`.`blog_comment`
55 55
             WHERE `permalink` = :permalink
56 56
             LIMIT 1";
57 57
 
58
-        $bindings = [
59
-            'permalink' => $permalink,
60
-        ];
58
+		$bindings = [
59
+			'permalink' => $permalink,
60
+		];
61 61
 
62
-        return $this
63
-            ->connections
64
-            ->getRead()
65
-            ->fetchOne($query, $bindings);
66
-    }
62
+		return $this
63
+			->connections
64
+			->getRead()
65
+			->fetchOne($query, $bindings);
66
+	}
67 67
 
68
-    public function insertBlogComment($permalink, DateTime $datetime, array $metadata)
69
-    {
70
-        $query = "
68
+	public function insertBlogComment($permalink, DateTime $datetime, array $metadata)
69
+	{
70
+		$query = "
71 71
             INSERT INTO `jpemeric_stream`.`blog_comment`
72 72
                 (`permalink`, `datetime`, `metadata`)
73 73
             VALUES
74 74
                 (:permalink, :datetime, :metadata)";
75 75
 
76
-        $bindings = [
77
-            'permalink' => $permalink,
78
-            'datetime' => $datetime->format('Y-m-d H:i:s'),
79
-            'metadata' => json_encode($metadata),
80
-        ];
76
+		$bindings = [
77
+			'permalink' => $permalink,
78
+			'datetime' => $datetime->format('Y-m-d H:i:s'),
79
+			'metadata' => json_encode($metadata),
80
+		];
81 81
 
82
-        return $this
83
-            ->connections
84
-            ->getWrite()
85
-            ->perform($query, $bindings);
86
-    }
82
+		return $this
83
+			->connections
84
+			->getWrite()
85
+			->perform($query, $bindings);
86
+	}
87 87
 }
Please login to merge, or discard this patch.
src/Domain/Stream/Blog/BlogRepositoryInterface.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,6 +4,6 @@
 block discarded – undo
4 4
 
5 5
 interface BlogRepositoryInterface
6 6
 {
7
-    public function getBlogById($id);
8
-    public function getBlogByTitle($title);
7
+	public function getBlogById($id);
8
+	public function getBlogByTitle($title);
9 9
 }
Please login to merge, or discard this patch.
src/Domain/Stream/Twitter/TwitterRepositoryInterface.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,6 +4,6 @@
 block discarded – undo
4 4
 
5 5
 interface TwitterRepositoryInterface
6 6
 {
7
-    public function getTwitterById($id);
8
-    public function getUnmappedTwitters();
7
+	public function getTwitterById($id);
8
+	public function getUnmappedTwitters();
9 9
 }
Please login to merge, or discard this patch.
script/cron/fetch-blog-activity.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -13,24 +13,24 @@  discard block
 block discarded – undo
13 13
 
14 14
 $blogFeed = Feed::loadRss('http://blog.jacobemerick.com/rss.xml');
15 15
 foreach ($blogFeed->item as $item) {
16
-    $datetime = new DateTime($item->pubDate);
17
-    if ($datetime <= $mostRecentBlogDateTime) {
18
-        break;
19
-    }
20
-
21
-    $uniqueBlogCheck = $blogRepository->getBlogByPermalink((string) $item->guid);
22
-    if ($uniqueBlogCheck !== false) {
23
-        continue;
24
-    }
25
-
26
-    $datetime->setTimezone($container['default_timezone']);
27
-    $metadata = json_decode(json_encode($item), true);
28
-
29
-    $blogRepository->insertBlog(
30
-        (string) $item->guid,
31
-        $datetime,
32
-        $metadata
33
-    );
16
+	$datetime = new DateTime($item->pubDate);
17
+	if ($datetime <= $mostRecentBlogDateTime) {
18
+		break;
19
+	}
20
+
21
+	$uniqueBlogCheck = $blogRepository->getBlogByPermalink((string) $item->guid);
22
+	if ($uniqueBlogCheck !== false) {
23
+		continue;
24
+	}
25
+
26
+	$datetime->setTimezone($container['default_timezone']);
27
+	$metadata = json_decode(json_encode($item), true);
28
+
29
+	$blogRepository->insertBlog(
30
+		(string) $item->guid,
31
+		$datetime,
32
+		$metadata
33
+	);
34 34
 }
35 35
 
36 36
 $blogCommentRepository = new BlogCommentRepository($container['db_connection_locator']);
@@ -41,22 +41,22 @@  discard block
 block discarded – undo
41 41
 
42 42
 $commentFeed = Feed::loadRss('http://blog.jacobemerick.com/rss-comments.xml');
43 43
 foreach ($commentFeed->item as $item) {
44
-    $datetime = new DateTime($item->pubDate);
45
-    if ($datetime <= $mostRecentBlogCommentDateTime) {
46
-        break;
47
-    }
48
-
49
-    $uniqueBlogCommentCheck = $blogCommentRepository->getBlogCommentByPermalink((string) $item->guid);
50
-    if ($uniqueBlogCommentCheck !== false) {
51
-        continue;
52
-    }
53
-
54
-    $datetime->setTimezone($container['default_timezone']);
55
-    $metadata = json_decode(json_encode($item), true);
56
-
57
-    $blogCommentRepository->insertBlogComment(
58
-        (string) $item->guid,
59
-        $datetime,
60
-        $metadata
61
-    );
44
+	$datetime = new DateTime($item->pubDate);
45
+	if ($datetime <= $mostRecentBlogCommentDateTime) {
46
+		break;
47
+	}
48
+
49
+	$uniqueBlogCommentCheck = $blogCommentRepository->getBlogCommentByPermalink((string) $item->guid);
50
+	if ($uniqueBlogCommentCheck !== false) {
51
+		continue;
52
+	}
53
+
54
+	$datetime->setTimezone($container['default_timezone']);
55
+	$metadata = json_decode(json_encode($item), true);
56
+
57
+	$blogCommentRepository->insertBlogComment(
58
+		(string) $item->guid,
59
+		$datetime,
60
+		$metadata
61
+	);
62 62
 }
Please login to merge, or discard this patch.
script/cron/fetch-goodreads-activity.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 use Jacobemerick\Web\Domain\Stream\Goodread\MysqlGoodreadRepository as GoodreadRepository;
7 7
 
8 8
 $client = new Client([
9
-    'base_uri' => 'http://www.goodreads.com',
9
+	'base_uri' => 'http://www.goodreads.com',
10 10
 ]);
11 11
 
12 12
 $goodreadRepository = new GoodreadRepository($container['db_connection_locator']);
@@ -20,23 +20,23 @@  discard block
 block discarded – undo
20 20
 $reviews = simplexml_load_string($reviews, 'SimpleXMLElement', LIBXML_NOCDATA);
21 21
 
22 22
 foreach ($reviews->channel->item as $review) {
23
-    $datetime = new DateTime((string) $review->pubDate);
24
-    if ($datetime <= $mostRecentReviewDateTime) {
25
-        break;
26
-    }
27
-
28
-    $uniqueReviewCheck = $goodreadRepository->getReviewByPermalink((string) $review->guid);
29
-    if ($uniqueReviewCheck !== false) {
30
-        continue;
31
-    }
32
-
33
-    $datetime->setTimezone($container['default_timezone']);
34
-    $metadata = json_decode(json_encode($review), true);
35
-
36
-    $goodreadRepository->insertReview(
37
-        (string) $review->guid,
38
-        (string) $review->book_id,
39
-        $datetime,
40
-        $metadata
41
-    );
23
+	$datetime = new DateTime((string) $review->pubDate);
24
+	if ($datetime <= $mostRecentReviewDateTime) {
25
+		break;
26
+	}
27
+
28
+	$uniqueReviewCheck = $goodreadRepository->getReviewByPermalink((string) $review->guid);
29
+	if ($uniqueReviewCheck !== false) {
30
+		continue;
31
+	}
32
+
33
+	$datetime->setTimezone($container['default_timezone']);
34
+	$metadata = json_decode(json_encode($review), true);
35
+
36
+	$goodreadRepository->insertReview(
37
+		(string) $review->guid,
38
+		(string) $review->book_id,
39
+		$datetime,
40
+		$metadata
41
+	);
42 42
 }
Please login to merge, or discard this patch.
script/manual/historic-twitter-fetch.php 1 patch
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -4,17 +4,17 @@  discard block
 block discarded – undo
4 4
 
5 5
 $options = getopt('f:');
6 6
 if (empty($options['f'])) {
7
-    exit('Must pass in a file with the f parameter.');
7
+	exit('Must pass in a file with the f parameter.');
8 8
 }
9 9
 
10 10
 use Abraham\TwitterOAuth\TwitterOAuth;
11 11
 use Jacobemerick\Web\Domain\Stream\Twitter\MysqlTwitterRepository as TwitterRepository;
12 12
 
13 13
 $client = new TwitterOAuth(
14
-    $config->twitter->consumer_key,
15
-    $config->twitter->consumer_secret,
16
-    $config->twitter->access_token,
17
-    $config->twitter->access_token_secret
14
+	$config->twitter->consumer_key,
15
+	$config->twitter->consumer_secret,
16
+	$config->twitter->access_token,
17
+	$config->twitter->access_token_secret
18 18
 );
19 19
 $client->setDecodeJsonAsArray(true);
20 20
 
@@ -24,29 +24,29 @@  discard block
 block discarded – undo
24 24
 
25 25
 $handle = fopen(__DIR__ . '/' . $options['f'], 'r');
26 26
 while ($row = fgets($handle)) {
27
-    array_push($idList, trim($row));
28
-    if (count($idList) == 100) {
29
-        $tweetLookup = $client->get('statuses/lookup', [
30
-            'id' => implode(',', $idList),
31
-            'trim_user' => true,
32
-        ]);
33
-
34
-        foreach ($tweetLookup as $tweet) {
35
-            $uniqueTweetCheck = $twitterRepository->getTwitterByTweetId($tweet['id_str']);
36
-            if ($uniqueTweetCheck !== false) {
37
-                if ($uniqueTweetCheck['metadata'] != json_encode($tweet)) {
38
-                    $twitterRepository->updateTweetMetadata($tweet['id_str'], $tweet);
39
-                }
40
-                continue;
41
-            }
42
-
43
-            $twitterRepository->insertTweet(
44
-                $tweet['id_str'],
45
-                (new DateTime($tweet['created_at']))->setTimezone($container['default_timezone']),
46
-                $tweet
47
-            );
48
-        }
49
-        $idList = [];
50
-    }
27
+	array_push($idList, trim($row));
28
+	if (count($idList) == 100) {
29
+		$tweetLookup = $client->get('statuses/lookup', [
30
+			'id' => implode(',', $idList),
31
+			'trim_user' => true,
32
+		]);
33
+
34
+		foreach ($tweetLookup as $tweet) {
35
+			$uniqueTweetCheck = $twitterRepository->getTwitterByTweetId($tweet['id_str']);
36
+			if ($uniqueTweetCheck !== false) {
37
+				if ($uniqueTweetCheck['metadata'] != json_encode($tweet)) {
38
+					$twitterRepository->updateTweetMetadata($tweet['id_str'], $tweet);
39
+				}
40
+				continue;
41
+			}
42
+
43
+			$twitterRepository->insertTweet(
44
+				$tweet['id_str'],
45
+				(new DateTime($tweet['created_at']))->setTimezone($container['default_timezone']),
46
+				$tweet
47
+			);
48
+		}
49
+		$idList = [];
50
+	}
51 51
 }
52 52
 fclose($handle);
Please login to merge, or discard this patch.