Code Duplication    Length = 15-15 lines in 2 locations

models/News.php 1 location

@@ 323-337 (lines=15) @@
320
     *
321
     * @return News[] An array of news objects
322
     */
323
    public static function getNews($start = 0, $limit = 5, $getDrafts = false)
324
    {
325
        $qb = self::getQueryBuilder()
326
            ->limit($limit)
327
            ->offset($start)
328
            ->orderBy('created', 'DESC')
329
            ->active()
330
        ;
331
332
        if ($getDrafts) {
333
            $qb->orWhere('is_draft', '=', true);
334
        }
335
336
        return $qb->getModels(true);
337
    }
338
339
    /**
340
     * Get a query builder for news

models/NewsCategory.php 1 location

@@ 105-119 (lines=15) @@
102
     *
103
     * @return News[] An array of news objects
104
     */
105
    public function getNews($start = 0, $limit = 5, $getDrafts = false)
106
    {
107
        $qb = News::getQueryBuilder()
108
            ->limit($limit)
109
            ->offset($start)
110
            ->active()
111
            ->where('category', '=', $this->getId())
112
        ;
113
114
        if ($getDrafts) {
115
            $qb->whereNot('is_draft', '=', true);
116
        }
117
118
        return $qb->getModels(true);
119
    }
120
121
    /**
122
     * Check if the category is protected from being deleted