Code Duplication    Length = 15-16 lines in 3 locations

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

@@ 43-57 (lines=15) @@
40
     *
41
     * @return LanguageEntity[]
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 all translated languages.
@@ 64-79 (lines=16) @@
61
     *
62
     * @return LanguageEntity[]
63
     */
64
    public function fetchAllTranslated()
65
    {
66
        $statement = $this->connection->createQueryBuilder()
67
            ->select('*')
68
            ->from(self::TABLE)
69
            ->where('is_translated = 1')
70
            ->execute();
71
72
        $result = $statement->fetchAll();
73
74
        if ($result === false) {
75
            return null;
76
        }
77
78
        return $this->getEntityArrayFromDatabaseArray($result);
79
    }
80
81
    /**
82
     * Creates a language in the database.

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

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