Code Duplication    Length = 14-17 lines in 2 locations

lib/Author.php 1 location

@@ 45-58 (lines=14) @@
42
        return parent::getCountGeneric ("authors", self::ALL_AUTHORS_ID, parent::PAGE_ALL_AUTHORS);
43
    }
44
45
    public static function getAllAuthorsByFirstLetter() {
46
        list (, $result) = parent::executeQuery ("select {0}
47
from authors
48
group by substr (upper (sort), 1, 1)
49
order by substr (upper (sort), 1, 1)", "substr (upper (sort), 1, 1) as title, count(*) as count", "", array (), -1);
50
        $entryArray = array();
51
        while ($post = $result->fetchObject ())
52
        {
53
            array_push ($entryArray, new Entry ($post->title, Author::getEntryIdByLetter ($post->title),
54
                str_format (localize("authorword", $post->count), $post->count), "text",
55
                array ( new LinkNavigation ("?page=".parent::PAGE_AUTHORS_FIRST_LETTER."&id=". rawurlencode ($post->title))), "", $post->count));
56
        }
57
        return $entryArray;
58
    }
59
60
    public static function getAuthorsByStartingLetter($letter) {
61
        return self::getEntryArray (self::SQL_AUTHORS_BY_FIRST_LETTER, array ($letter . "%"));

lib/Book.php 1 location

@@ 699-715 (lines=17) @@
696
        return array($entryArray, $totalNumber);
697
    }
698
699
    public static function getAllBooks() {
700
        /* @var $result PDOStatement */
701
702
        list (, $result) = parent::executeQuery('select {0}
703
from books
704
group by substr (upper (sort), 1, 1)
705
order by substr (upper (sort), 1, 1)', 'substr (upper (sort), 1, 1) as title, count(*) as count', self::getFilterString(), array(), -1);
706
707
        $entryArray = array();
708
        while ($post = $result->fetchObject())
709
        {
710
            array_push($entryArray, new Entry($post->title, Book::getEntryIdByLetter($post->title),
711
                str_format(localize('bookword', $post->count), $post->count), 'text',
712
                array(new LinkNavigation('?page='.parent::PAGE_ALL_BOOKS_LETTER.'&id='. rawurlencode($post->title))), '', $post->count));
713
        }
714
        return $entryArray;
715
    }
716
717
    public static function getBooksByStartingLetter($letter, $n, $database = NULL, $numberPerPage = NULL) {
718
        return self::getEntryArray(self::SQL_BOOKS_BY_FIRST_LETTER, array($letter . '%'), $n, $database, $numberPerPage);