Code Duplication    Length = 15-16 lines in 3 locations

htdocs/src/Oc/Language/LanguageRepository.php 2 locations

@@ 46-60 (lines=15) @@
43
     *
44
     * @throws RecordsNotFoundException Thrown when no records are found
45
     */
46
    public function fetchAll()
47
    {
48
        $statement = $this->connection->createQueryBuilder()
49
            ->select('*')
50
            ->from(self::TABLE)
51
            ->execute();
52
53
        $result = $statement->fetchAll();
54
55
        if ($statement->rowCount() === 0) {
56
            throw new RecordsNotFoundException('No records found');
57
        }
58
59
        return $this->getEntityArrayFromDatabaseArray($result);
60
    }
61
62
    /**
63
     * Fetches all translated languages.
@@ 69-84 (lines=16) @@
66
     *
67
     * @throws RecordsNotFoundException Thrown when no records are found
68
     */
69
    public function fetchAllTranslated()
70
    {
71
        $statement = $this->connection->createQueryBuilder()
72
            ->select('*')
73
            ->from(self::TABLE)
74
            ->where('is_translated = 1')
75
            ->execute();
76
77
        $result = $statement->fetchAll();
78
79
        if ($statement->rowCount() === 0) {
80
            throw new RecordsNotFoundException('No records with given where clause found');
81
        }
82
83
        return $this->getEntityArrayFromDatabaseArray($result);
84
    }
85
86
    /**
87
     * Creates a language in the database.

htdocs/src/Oc/User/UserRepository.php 1 location

@@ 47-61 (lines=15) @@
44
     *
45
     * @throws RecordsNotFoundException Thrown when no records are found
46
     */
47
    public function fetchAll()
48
    {
49
        $statement = $this->connection->createQueryBuilder()
50
            ->select('*')
51
            ->from(self::TABLE)
52
            ->execute();
53
54
        $result = $statement->fetchAll();
55
56
        if ($statement->rowCount() === 0) {
57
            throw new RecordsNotFoundException('No records found');
58
        }
59
60
        return $this->getEntityArrayFromDatabaseArray($result);
61
    }
62
63
    /**
64
     * Fetches a user by its id.