Code Duplication    Length = 20-21 lines in 2 locations

src/Domain/Blog/Post/MysqlPostRepository.php 1 location

@@ 46-66 (lines=21) @@
43
            ->fetchOne($query, $bindings);
44
    }
45
46
    public function getActivePosts($limit = null, $offset = 0)
47
    {
48
        $query = "
49
            SELECT `id`, `title`, `path`, `date`, `body`, `category`
50
            FROM `jpemeric_blog`.`post`
51
            WHERE `display` = :is_active
52
            ORDER BY `date` DESC";
53
        if ($limit != null) {
54
            $query .= "
55
            LIMIT {$offset}, {$limit}";
56
        }
57
58
        $bindings = [
59
            'is_active' => 1,
60
        ];
61
62
        return $this
63
            ->connections
64
            ->getRead()
65
            ->fetchAll($query, $bindings);
66
    }
67
68
    public function getActivePostsCount()
69
    {

src/Domain/Stream/Post/MysqlPostRepository.php 1 location

@@ 102-121 (lines=20) @@
99
            ->fetchValue($query);
100
    }
101
102
    public function getPostsByType($type, $limit = null, $offset = 0)
103
    {
104
        $query = "
105
            SELECT *
106
            FROM `jpemeric_stream`.`post`
107
            WHERE `type` = :type
108
            ORDER BY `date` DESC";
109
        if (!is_null($limit)) {
110
            $query .= "
111
            LIMIT {$offset}, {$limit}";
112
        }
113
        $bindings = [
114
            'type' => $type,
115
        ];
116
117
        return $this
118
            ->connections
119
            ->getRead()
120
            ->fetchAll($query, $bindings);
121
    }
122
123
    public function getPostsByTypeCount($type)
124
    {