Completed
Push — master ( 8817c3...c1b66d )
by Jacob
03:14
created
src/Domain/Stream/Activity/MysqlActivityRepository.php 1 patch
Indentation   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -7,108 +7,108 @@
 block discarded – undo
7 7
 class MysqlActivityRepository implements ActivityRepositoryInterface
8 8
 {
9 9
 
10
-    /** @var  ConnectionLocator */
11
-    protected $connections;
10
+	/** @var  ConnectionLocator */
11
+	protected $connections;
12 12
 
13
-    /**
14
-     * @param ConnectonLocator $connections
15
-     */
16
-    public function __construct(ConnectionLocator $connections)
17
-    {
18
-        $this->connections = $connections;
19
-    }
13
+	/**
14
+	 * @param ConnectonLocator $connections
15
+	 */
16
+	public function __construct(ConnectionLocator $connections)
17
+	{
18
+		$this->connections = $connections;
19
+	}
20 20
 
21
-    /**
22
-     * @param integer $id
23
-     *
24
-     * @return array|false
25
-     */
26
-    public function getActivityById($id)
27
-    {
28
-        $query = "
21
+	/**
22
+	 * @param integer $id
23
+	 *
24
+	 * @return array|false
25
+	 */
26
+	public function getActivityById($id)
27
+	{
28
+		$query = "
29 29
             SELECT *
30 30
             FROM `jpemeric_stream`.`activity`
31 31
             WHERE `id` = :id
32 32
             LIMIT 1";
33
-        $bindings = [
34
-            'id' => $id,
35
-        ];
33
+		$bindings = [
34
+			'id' => $id,
35
+		];
36 36
 
37
-        return $this
38
-            ->connections
39
-            ->getRead()
40
-            ->fetchOne($query, $bindings);
41
-    }
37
+		return $this
38
+			->connections
39
+			->getRead()
40
+			->fetchOne($query, $bindings);
41
+	}
42 42
 
43
-    /**
44
-     * @param integer $limit
45
-     * @param integer $offset
46
-     *
47
-     * @return array|false
48
-     */
49
-    public function getActivities($limit = null, $offset = 0)
50
-    {
51
-        $query = "
43
+	/**
44
+	 * @param integer $limit
45
+	 * @param integer $offset
46
+	 *
47
+	 * @return array|false
48
+	 */
49
+	public function getActivities($limit = null, $offset = 0)
50
+	{
51
+		$query = "
52 52
             SELECT *
53 53
             FROM `jpemeric_stream`.`activity`
54 54
             ORDER BY `datetime` DESC";
55
-        if (!is_null($limit)) {
56
-            $query .= "
55
+		if (!is_null($limit)) {
56
+			$query .= "
57 57
             LIMIT {$offset}, {$limit}";
58
-        }
58
+		}
59 59
 
60
-        return $this
61
-            ->connections
62
-            ->getRead()
63
-            ->fetchAll($query);
64
-    }
60
+		return $this
61
+			->connections
62
+			->getRead()
63
+			->fetchAll($query);
64
+	}
65 65
 
66
-    public function getActivitiesCount()
67
-    {
68
-        $query = "
66
+	public function getActivitiesCount()
67
+	{
68
+		$query = "
69 69
             SELECT COUNT(1) AS `count`
70 70
             FROM `jpemeric_stream`.`activity`";
71 71
 
72
-        return $this
73
-            ->connections
74
-            ->getRead()
75
-            ->fetchValue($query);
76
-    }
72
+		return $this
73
+			->connections
74
+			->getRead()
75
+			->fetchValue($query);
76
+	}
77 77
 
78
-    public function getActivitiesByType($type, $limit = null, $offset = 0)
79
-    {
80
-        $query = "
78
+	public function getActivitiesByType($type, $limit = null, $offset = 0)
79
+	{
80
+		$query = "
81 81
             SELECT *
82 82
             FROM `jpemeric_stream`.`activity`
83 83
             WHERE `type` = :type
84 84
             ORDER BY `datetime` DESC";
85
-        if (!is_null($limit)) {
86
-            $query .= "
85
+		if (!is_null($limit)) {
86
+			$query .= "
87 87
             LIMIT {$offset}, {$limit}";
88
-        }
89
-        $bindings = [
90
-            'type' => $type,
91
-        ];
88
+		}
89
+		$bindings = [
90
+			'type' => $type,
91
+		];
92 92
 
93
-        return $this
94
-            ->connections
95
-            ->getRead()
96
-            ->fetchAll($query, $bindings);
97
-    }
93
+		return $this
94
+			->connections
95
+			->getRead()
96
+			->fetchAll($query, $bindings);
97
+	}
98 98
 
99
-    public function getActivitiesByTypeCount($type)
100
-    {
101
-        $query = "
99
+	public function getActivitiesByTypeCount($type)
100
+	{
101
+		$query = "
102 102
             SELECT COUNT(1) AS `count`
103 103
             FROM `jpemeric_stream`.`activity`
104 104
             WHERE `type` = :type";
105
-        $bindings = [
106
-            'type' => $type,
107
-        ];
105
+		$bindings = [
106
+			'type' => $type,
107
+		];
108 108
 
109
-        return $this
110
-            ->connections
111
-            ->getRead()
112
-            ->fetchValue($query, $bindings);
113
-    }
109
+		return $this
110
+			->connections
111
+			->getRead()
112
+			->fetchValue($query, $bindings);
113
+	}
114 114
 }
Please login to merge, or discard this patch.
src/Domain/Stream/Twitter/MysqlTwitterRepository.php 1 patch
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -8,70 +8,70 @@
 block discarded – undo
8 8
 class MysqlTwitterRepository implements TwitterRepositoryInterface
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
-    public function getTwitterByTweetId($tweetId)
23
-    {
24
-        $query = "
22
+	public function getTwitterByTweetId($tweetId)
23
+	{
24
+		$query = "
25 25
             SELECT `id`, `tweet_id`, `datetime`, `metadata`
26 26
             FROM `jpemeric_stream`.`twitter`
27 27
             WHERE `tweet_id` = :tweet_id
28 28
             LIMIT 1";
29 29
 
30
-        $bindings = [
31
-            'tweet_id' => $tweetId,
32
-        ];
30
+		$bindings = [
31
+			'tweet_id' => $tweetId,
32
+		];
33 33
 
34
-        return $this
35
-            ->connections
36
-            ->getRead()
37
-            ->fetchOne($query, $bindings);
38
-    }
34
+		return $this
35
+			->connections
36
+			->getRead()
37
+			->fetchOne($query, $bindings);
38
+	}
39 39
 
40
-    public function insertTweet($tweetId, DateTime $datetime, array $metadata)
41
-    {
42
-        $query = "
40
+	public function insertTweet($tweetId, DateTime $datetime, array $metadata)
41
+	{
42
+		$query = "
43 43
             INSERT INTO `jpemeric_stream`.`twitter`
44 44
                 (`tweet_id`, `datetime`, `metadata`)
45 45
             VALUES
46 46
                 (:tweet_id, :datetime, :metadata)";
47 47
 
48
-        $bindings = [
49
-            'tweet_id' => $tweetId,
50
-            'datetime' => $datetime->format('Y-m-d H:i:s'),
51
-            'metadata' => json_encode($metadata),
52
-        ];
48
+		$bindings = [
49
+			'tweet_id' => $tweetId,
50
+			'datetime' => $datetime->format('Y-m-d H:i:s'),
51
+			'metadata' => json_encode($metadata),
52
+		];
53 53
 
54
-        return $this
55
-            ->connections
56
-            ->getWrite()
57
-            ->perform($query, $bindings);
58
-    }
54
+		return $this
55
+			->connections
56
+			->getWrite()
57
+			->perform($query, $bindings);
58
+	}
59 59
 
60
-    public function updateTweetMetadata($tweetId, array $metadata)
61
-    {
62
-        $query = "
60
+	public function updateTweetMetadata($tweetId, array $metadata)
61
+	{
62
+		$query = "
63 63
             UPDATE `jpemeric_stream`.`twitter`
64 64
             SET `metadata` = :metadata
65 65
             WHERE `tweet_id` = :tweet_id";
66 66
 
67
-        $bindings = [
68
-            'metadata' => json_encode($metadata),
69
-            'tweet_id' => $tweetId,
70
-        ];
67
+		$bindings = [
68
+			'metadata' => json_encode($metadata),
69
+			'tweet_id' => $tweetId,
70
+		];
71 71
 
72
-        return $this
73
-            ->connections
74
-            ->getWrite()
75
-            ->perform($query, $bindings);
76
-    }
72
+		return $this
73
+			->connections
74
+			->getWrite()
75
+			->perform($query, $bindings);
76
+	}
77 77
 }
Please login to merge, or discard this patch.