Code Duplication    Length = 21-21 lines in 4 locations

htdocs/src/Oc/Country/CountryRepository.php 1 location

@@ 46-66 (lines=21) @@
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
        $countries = [];
60
61
        foreach ($result as $item) {
62
            $countries[] = $this->getEntityFromDatabaseArray($item);
63
        }
64
65
        return $countries;
66
    }
67
68
    /**
69
     * Creates a country in the database.

htdocs/src/Oc/FieldNotes/Persistence/FieldNoteRepository.php 1 location

@@ 48-68 (lines=21) @@
45
     *
46
     * @throws RecordsNotFoundException Thrown when no records are found
47
     */
48
    public function fetchAll()
49
    {
50
        $statement = $this->connection->createQueryBuilder()
51
            ->select('*')
52
            ->from(self::TABLE)
53
            ->execute();
54
55
        $result = $statement->fetchAll();
56
57
        if ($statement->rowCount() === 0) {
58
            throw new RecordsNotFoundException('No records found');
59
        }
60
61
        $entities = [];
62
63
        foreach ($result as $item) {
64
            $entities[] = $this->getEntityFromDatabaseArray($item);
65
        }
66
67
        return $entities;
68
    }
69
70
    /**
71
     * Fetches all GeoCaches by given where clause.

htdocs/src/Oc/GeoCache/Persistence/GeoCache/GeoCacheRepository.php 1 location

@@ 44-64 (lines=21) @@
41
     *
42
     * @throws RecordsNotFoundException Thrown when no records are found
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 ($statement->rowCount() === 0) {
54
            throw new RecordsNotFoundException('No records found');
55
        }
56
57
        $records = [];
58
59
        foreach ($result as $item) {
60
            $records[] = $this->getEntityFromDatabaseArray($item);
61
        }
62
63
        return $records;
64
    }
65
66
    /**
67
     * Fetches a GeoCache by given where clause.

htdocs/src/Oc/GeoCache/Persistence/GeoCacheLog/GeoCacheLogRepository.php 1 location

@@ 43-63 (lines=21) @@
40
     *
41
     * @throws RecordsNotFoundException Thrown when no records are found
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 ($statement->rowCount() === 0) {
53
            throw new RecordsNotFoundException('No records found');
54
        }
55
56
        $records = [];
57
58
        foreach ($result as $item) {
59
            $records[] = $this->getEntityFromDatabaseArray($item);
60
        }
61
62
        return $records;
63
    }
64
65
    /**
66
     * Fetches a GeoCacheLog by given where clause.