@@ -8,48 +8,48 @@ |
||
8 | 8 | class MysqlBlogRepository implements BlogRepositoryInterface |
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 | - public function getBlogByPermalink($permalink) |
|
23 | - { |
|
24 | - $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 | + public function getBlogByPermalink($permalink) |
|
23 | + { |
|
24 | + $query = " |
|
25 | 25 | SELECT * |
26 | 26 | FROM `jpemeric_stream`.`blog` |
27 | 27 | WHERE `permalink` = :permalink |
28 | 28 | LIMIT 1"; |
29 | - $bindings = [ |
|
30 | - 'permalink' => $permalink, |
|
31 | - ]; |
|
32 | - |
|
33 | - return $this |
|
34 | - ->connections |
|
35 | - ->getRead() |
|
36 | - ->fetchOne($query, $bindings); |
|
37 | - } |
|
38 | - |
|
39 | - public function getBlogsUpdatedSince(DateTime $datetime) |
|
40 | - { |
|
41 | - $query = " |
|
29 | + $bindings = [ |
|
30 | + 'permalink' => $permalink, |
|
31 | + ]; |
|
32 | + |
|
33 | + return $this |
|
34 | + ->connections |
|
35 | + ->getRead() |
|
36 | + ->fetchOne($query, $bindings); |
|
37 | + } |
|
38 | + |
|
39 | + public function getBlogsUpdatedSince(DateTime $datetime) |
|
40 | + { |
|
41 | + $query = " |
|
42 | 42 | SELECT * |
43 | 43 | FROM `jpemeric_stream`.`blog` |
44 | 44 | WHERE `updated_at` >= :last_update"; |
45 | 45 | |
46 | - $bindings = [ |
|
47 | - 'last_update' => $datetime->format('Y-m-d H:i:s'), |
|
48 | - ]; |
|
46 | + $bindings = [ |
|
47 | + 'last_update' => $datetime->format('Y-m-d H:i:s'), |
|
48 | + ]; |
|
49 | 49 | |
50 | - return $this |
|
51 | - ->connections |
|
52 | - ->getRead() |
|
53 | - ->fetchAll($query, $bindings); |
|
54 | - } |
|
50 | + return $this |
|
51 | + ->connections |
|
52 | + ->getRead() |
|
53 | + ->fetchAll($query, $bindings); |
|
54 | + } |
|
55 | 55 | } |
@@ -8,60 +8,60 @@ |
||
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 | } |
@@ -8,31 +8,31 @@ |
||
8 | 8 | class MysqlDailyMileRepository implements DailyMileRepositoryInterface |
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 | - public function getDailyMilesUpdatedSince(DateTime $datetime) |
|
23 | - { |
|
24 | - $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 | + public function getDailyMilesUpdatedSince(DateTime $datetime) |
|
23 | + { |
|
24 | + $query = " |
|
25 | 25 | SELECT * |
26 | 26 | FROM `jpemeric_stream`.`dailymile` |
27 | 27 | WHERE `updated_at` >= :last_update"; |
28 | 28 | |
29 | - $bindings = [ |
|
30 | - 'last_update' => $datetime->format('Y-m-d H:i:s'), |
|
31 | - ]; |
|
29 | + $bindings = [ |
|
30 | + 'last_update' => $datetime->format('Y-m-d H:i:s'), |
|
31 | + ]; |
|
32 | 32 | |
33 | - return $this |
|
34 | - ->connections |
|
35 | - ->getRead() |
|
36 | - ->fetchAll($query, $bindings); |
|
37 | - } |
|
33 | + return $this |
|
34 | + ->connections |
|
35 | + ->getRead() |
|
36 | + ->fetchAll($query, $bindings); |
|
37 | + } |
|
38 | 38 | } |