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

@@ 79-93 (lines=15) @@
76
     *
77
     * @return News[] An array of news objects
78
     */
79
    public function getNews($start = 0, $limit = 5, $getDrafts = false)
80
    {
81
        $qb = News::getQueryBuilder()
82
            ->limit($limit)
83
            ->offset($start)
84
            ->active()
85
            ->where('category', '=', $this->getId())
86
        ;
87
88
        if ($getDrafts) {
89
            $qb->whereNot('is_draft', '=', true);
90
        }
91
92
        return $qb->getModels(true);
93
    }
94
95
    /**
96
     * Check if the category is protected from being deleted.