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

@@ 682-698 (lines=17) @@
679
        return array($entryArray, $totalNumber);
680
    }
681
682
    public static function getAllBooks() {
683
        /* @var $result PDOStatement */
684
685
        list (, $result) = parent::executeQuery('select {0}
686
from books
687
group by substr (upper (sort), 1, 1)
688
order by substr (upper (sort), 1, 1)', 'substr (upper (sort), 1, 1) as title, count(*) as count', self::getFilterString(), array(), -1);
689
690
        $entryArray = array();
691
        while ($post = $result->fetchObject())
692
        {
693
            array_push($entryArray, new Entry($post->title, Book::getEntryIdByLetter($post->title),
694
                str_format(localize('bookword', $post->count), $post->count), 'text',
695
                array(new LinkNavigation('?page='.parent::PAGE_ALL_BOOKS_LETTER.'&id='. rawurlencode($post->title))), '', $post->count));
696
        }
697
        return $entryArray;
698
    }
699
700
    public static function getBooksByStartingLetter($letter, $n, $database = NULL, $numberPerPage = NULL) {
701
        return self::getEntryArray(self::SQL_BOOKS_BY_FIRST_LETTER, array($letter . '%'), $n, $database, $numberPerPage);