Completed
Push — master ( f72f24...91217a )
by Jacob
13:23
created
src/Domain/Comment/Comment/MysqlCommentRepository.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
     protected $connections;
12 12
 
13 13
     /**
14
-     * @param Aura\Sql\ConnectionLocator $connections
14
+     * @param ConnectionLocator $connections
15 15
      */
16 16
     public function __construct(ConnectionLocator $connections)
17 17
     {
Please login to merge, or discard this patch.
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -7,26 +7,26 @@  discard block
 block discarded – undo
7 7
 class MysqlCommentRepository implements CommentRepositoryInterface
8 8
 {
9 9
 
10
-    /** @var  Aura\Sql\ConnectionLocator */
11
-    protected $connections;
12
-
13
-    /**
14
-     * @param Aura\Sql\ConnectionLocator $connections
15
-     */
16
-    public function __construct(ConnectionLocator $connections)
17
-    {
18
-        $this->connections = $connections;
19
-    }
20
-
21
-    public function getActiveCommentsBySite($site, $limit = null, $offset = 0)
22
-    {
23
-        if ($site == 'blog') {
24
-            $site_id = 2;
25
-        } else {
26
-            throw new Exception('Unrecognized site id in comment repository');
27
-        }
28
-
29
-        $query = "
10
+	/** @var  Aura\Sql\ConnectionLocator */
11
+	protected $connections;
12
+
13
+	/**
14
+	 * @param Aura\Sql\ConnectionLocator $connections
15
+	 */
16
+	public function __construct(ConnectionLocator $connections)
17
+	{
18
+		$this->connections = $connections;
19
+	}
20
+
21
+	public function getActiveCommentsBySite($site, $limit = null, $offset = 0)
22
+	{
23
+		if ($site == 'blog') {
24
+			$site_id = 2;
25
+		} else {
26
+			throw new Exception('Unrecognized site id in comment repository');
27
+		}
28
+
29
+		$query = "
30 30
             SELECT `comment_meta`.`id`, `comment_meta`.`date`, `comment`.`body`, `commenter`.`name`,
31 31
                    `post`.`title`, `post`.`category`, `post`.`path`
32 32
             FROM `jpemeric_comment`.`comment_meta`
@@ -39,21 +39,21 @@  discard block
 block discarded – undo
39 39
                                                  `post`.`display` = :display_post
40 40
             WHERE `comment_meta`.`display` = :active_comment
41 41
             ORDER BY `comment_meta`.`date` DESC";
42
-        if ($limit != null) {
43
-            $query .= "
42
+		if ($limit != null) {
43
+			$query .= "
44 44
             LIMIT {$offset}, {$limit}";
45
-        }
46
-
47
-        $bindings = [
48
-            'trusted_commenter' => 1,
49
-            'comment_site' => $site_id,
50
-            'display_post' => 1,
51
-            'active_comment' => 1,
52
-        ];
53
-
54
-        return $this
55
-            ->connections
56
-            ->getRead()
57
-            ->fetchAll($query, $bindings);
58
-    }
45
+		}
46
+
47
+		$bindings = [
48
+			'trusted_commenter' => 1,
49
+			'comment_site' => $site_id,
50
+			'display_post' => 1,
51
+			'active_comment' => 1,
52
+		];
53
+
54
+		return $this
55
+			->connections
56
+			->getRead()
57
+			->fetchAll($query, $bindings);
58
+	}
59 59
 }
Please login to merge, or discard this patch.
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 2 patches
Indentation   +62 added lines, -62 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,34 +88,34 @@  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
-    $blogCommentItem->author($blogComment['name']);
95
-
96
-    $url = "http://blog.jacobemerick.com/{$blogComment['category']}/{$blogComment['path']}/";
97
-    $url .= "#comment-{$blogComment['id']}";
98
-    $blogCommentItem->url($url);
99
-    $blogCommentItem->guid($url, true);
100
-
101
-    $description = $blogComment['body'];
102
-    $description = strip_tags($description);
103
-    $description = strtok($description, "\n");
104
-    if (strlen($description) > 250) {
105
-        $description = wordwrap($description, 250);
106
-        $description = strtok($description, "\n");
107
-        if (substr($description, -1) != '.') {
108
-            $description .= '…';
109
-        }
110
-    }
111
-    $description = html_entity_decode($description);
112
-    $description = trim($description);
113
-    $blogCommentItem->description($description);
114
-
115
-    $pubDate = new DateTime($blogComment['date']);
116
-    $blogCommentItem->pubDate($pubDate->getTimestamp());
117
-
118
-    $blogCommentItem->appendTo($blogCommentChannel);
91
+	$blogCommentItem = new Item();
92
+
93
+	$blogCommentItem->title("Comment on '{$blogComment['title']}' from {$blogComment['name']}");
94
+	$blogCommentItem->author($blogComment['name']);
95
+
96
+	$url = "http://blog.jacobemerick.com/{$blogComment['category']}/{$blogComment['path']}/";
97
+	$url .= "#comment-{$blogComment['id']}";
98
+	$blogCommentItem->url($url);
99
+	$blogCommentItem->guid($url, true);
100
+
101
+	$description = $blogComment['body'];
102
+	$description = strip_tags($description);
103
+	$description = strtok($description, "\n");
104
+	if (strlen($description) > 250) {
105
+		$description = wordwrap($description, 250);
106
+		$description = strtok($description, "\n");
107
+		if (substr($description, -1) != '.') {
108
+			$description .= '…';
109
+		}
110
+	}
111
+	$description = html_entity_decode($description);
112
+	$description = trim($description);
113
+	$blogCommentItem->description($description);
114
+
115
+	$pubDate = new DateTime($blogComment['date']);
116
+	$blogCommentItem->pubDate($pubDate->getTimestamp());
117
+
118
+	$blogCommentItem->appendTo($blogCommentChannel);
119 119
 }
120 120
 
121 121
 $buildFeed($blogCommentFeed, 'blog', 'rss-comments');
Please login to merge, or discard this patch.
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.