Code Duplication    Length = 18-18 lines in 2 locations

src/Database/Bindings/EntriesBinding.php 1 location

@@ 104-121 (lines=18) @@
101
     * @param array $params (Optional) Associative array of additional request parameters
102
     * @return Entry[]
103
     */
104
    public function listByLog($id, $params = [self::INCLUDE => [self::INCLUDE_USER]])
105
    {
106
        $statement = $this->database()->prepare("
107
            SELECT *
108
                FROM `" . $this->databaseTable() . "`
109
                WHERE
110
                  `" . Log::ID . "` = :id
111
                ORDER BY
112
                    " . $this->listOrder() . "
113
        ");
114
        $list = [];
115
        if ($statement->execute(['id' => $id])) {
116
            while ($row = $statement->fetch()) {
117
                $list[] = $this->instantiateListedObject($row, $params);
118
            }
119
        }
120
        return $list;
121
    }
122
123
    /**
124
     * Retrieve most recent entry of a specific log

src/Database/Bindings/LogsBinding.php 1 location

@@ 122-139 (lines=18) @@
119
     *
120
     * @return Log[]
121
     */
122
    public function listByDevice($id, $params = [self::INCLUDE => []])
123
    {
124
        $statement = $this->database()->prepare("
125
            SELECT *
126
                FROM `" . $this->databaseTable() . "`
127
                WHERE
128
                  `" . Device::ID . "` = :id
129
                ORDER BY
130
                    " . $this->listOrder() . "
131
        ");
132
        $list = [];
133
        if ($statement->execute(['id' => $id])) {
134
            while ($row = $statement->fetch()) {
135
                $list[] = $this->instantiateListedObject($row, $params);
136
            }
137
        }
138
        return $list;
139
    }
140
}
141