Code Duplication    Length = 17-19 lines in 6 locations

src/Domain/Stream/Activity/MysqlActivityRepository.php 1 location

@@ 182-198 (lines=17) @@
179
            ->perform($query, $bindings);
180
    }
181
182
    public function updateActivityMetadata($activityId, array $metadata)
183
    {
184
        $query = "
185
            UPDATE `jpemeric_stream`.`activity`
186
            SET `metadata` = :metadata
187
            WHERE `id` = :id";
188
189
        $bindings = [
190
            'metadata' => json_encode($metadata),
191
            'id' => $activityId,
192
        ];
193
194
        return $this
195
            ->connections
196
            ->getWrite()
197
            ->perform($query, $bindings);
198
    }
199
}
200

src/Domain/Stream/Blog/MysqlBlogRepository.php 1 location

@@ 117-135 (lines=19) @@
114
            ->fetchAll($query, $bindings);
115
    }
116
117
    public function insertBlog($permalink, DateTime $datetime, array $metadata)
118
    {
119
        $query = "
120
            INSERT INTO `jpemeric_stream`.`blog2`
121
                (`permalink`, `datetime`, `metadata`)
122
            VALUES
123
                (:permalink, :datetime, :metadata)";
124
125
        $bindings = [
126
            'permalink' => $permalink,
127
            'datetime' => $datetime->format('Y-m-d H:i:s'),
128
            'metadata' => json_encode($metadata),
129
        ];
130
131
        return $this
132
            ->connections
133
            ->getWrite()
134
            ->perform($query, $bindings);
135
    }
136
}
137

src/Domain/Stream/BlogComment/MysqlBlogCommentRepository.php 1 location

@@ 68-86 (lines=19) @@
65
            ->fetchOne($query, $bindings);
66
    }
67
68
    public function insertBlogComment($permalink, DateTime $datetime, array $metadata)
69
    {
70
        $query = "
71
            INSERT INTO `jpemeric_stream`.`blog_comment`
72
                (`permalink`, `datetime`, `metadata`)
73
            VALUES
74
                (:permalink, :datetime, :metadata)";
75
76
        $bindings = [
77
            'permalink' => $permalink,
78
            'datetime' => $datetime->format('Y-m-d H:i:s'),
79
            'metadata' => json_encode($metadata),
80
        ];
81
82
        return $this
83
            ->connections
84
            ->getWrite()
85
            ->perform($query, $bindings);
86
    }
87
}
88

src/Domain/Stream/Twitter/MysqlTwitterRepository.php 2 locations

@@ 103-121 (lines=19) @@
100
            ->fetchAll($query);
101
    }
102
103
    public function insertTweet($tweetId, DateTime $datetime, array $metadata)
104
    {
105
        $query = "
106
            INSERT INTO `jpemeric_stream`.`twitter2`
107
                (`tweet_id`, `datetime`, `metadata`)
108
            VALUES
109
                (:tweet_id, :datetime, :metadata)";
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
    {
@@ 123-139 (lines=17) @@
120
            ->perform($query, $bindings);
121
    }
122
123
    public function updateTweetMetadata($tweetId, array $metadata)
124
    {
125
        $query = "
126
            UPDATE `jpemeric_stream`.`twitter2`
127
            SET `metadata` = :metadata
128
            WHERE `tweet_id` = :tweet_id";
129
130
        $bindings = [
131
            'metadata' => json_encode($metadata),
132
            'tweet_id' => $tweetId,
133
        ];
134
135
        return $this
136
            ->connections
137
            ->getWrite()
138
            ->perform($query, $bindings);
139
    }
140
}
141

src/Domain/Stream/YouTube/MysqlYouTubeRepository.php 1 location

@@ 83-101 (lines=19) @@
80
            ->fetchOne($query, $bindings);
81
    }
82
83
    public function insertVideo($videoId, DateTime $datetime, array $metadata)
84
    {
85
        $query = "
86
            INSERT INTO `jpemeric_stream`.`youtube`
87
                (`video_id`, `datetime`, `metadata`)
88
            VALUES
89
                (:video_id, :datetime, :metadata)";
90
91
        $bindings = [
92
            'video_id' => $videoId,
93
            'datetime' => $datetime->format('Y-m-d H:i:s'),
94
            'metadata' => json_encode($metadata),
95
        ];
96
97
        return $this
98
            ->connections
99
            ->getWrite()
100
            ->perform($query, $bindings);
101
    }
102
}
103