Code Duplication    Length = 15-16 lines in 3 locations

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

@@ 44-58 (lines=15) @@
41
     *
42
     * @return LanguageEntity[]
43
     */
44
    public function fetchAll()
45
    {
46
        $statement = $this->connection->createQueryBuilder()
47
            ->select('*')
48
            ->from(self::TABLE)
49
            ->execute();
50
51
        $result = $statement->fetchAll();
52
53
        if ($result === false) {
54
            return [];
55
        }
56
57
        return $this->getEntityArrayFromDatabaseArray($result);
58
    }
59
60
    /**
61
     * Fetches all translated languages.
@@ 65-80 (lines=16) @@
62
     *
63
     * @return LanguageEntity[]
64
     */
65
    public function fetchAllTranslated()
66
    {
67
        $statement = $this->connection->createQueryBuilder()
68
            ->select('*')
69
            ->from(self::TABLE)
70
            ->where('is_translated = 1')
71
            ->execute();
72
73
        $result = $statement->fetchAll();
74
75
        if ($result === false) {
76
            return null;
77
        }
78
79
        return $this->getEntityArrayFromDatabaseArray($result);
80
    }
81
82
    /**
83
     * Creates a language in the database.

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

@@ 43-57 (lines=15) @@
40
     *
41
     * @return UserEntity[]
42
     */
43
    public function fetchAll()
44
    {
45
        $statement = $this->connection->createQueryBuilder()
46
            ->select('*')
47
            ->from(self::TABLE)
48
            ->execute();
49
50
        $result = $statement->fetchAll();
51
52
        if ($result === false) {
53
            return [];
54
        }
55
56
        return $this->getEntityArrayFromDatabaseArray($result);
57
    }
58
59
    /**
60
     * Fetches a user by its id.