Code Duplication    Length = 19-21 lines in 2 locations

src/App/ResultDB.php 2 locations

@@ 190-208 (lines=19) @@
187
     * @param   Variable $var
188
     * @return  int|null
189
     */
190
    protected function variable_id(Variable $var) {
191
        $res = $this->builder()
192
            ->select("id")
193
            ->from($this->variable_table())
194
            ->where($this->builder()->expr()->andX
195
                ( "name = ?"
196
                , "meaning = ?"
197
                ))
198
            ->setParameter(0, $var->name())
199
            ->setParameter(1, $var->meaning())
200
            ->execute()
201
            ->fetch();
202
        if ($res) {
203
            return (int)$res["id"];
204
        }
205
        else {
206
            return null;
207
        }
208
    }
209
210
    protected function upsert_variable(Variable $var) {
211
        $var_id = $this->variable_id($var);
@@ 255-275 (lines=21) @@
252
     * @param   Violation   $violation
253
     * @return  int|null
254
     */
255
    protected function violation_id(Violation $violation) {
256
        $res = $this->builder()
257
            ->select("id")
258
            ->from($this->violation_table())
259
            ->where($this->builder()->expr()->andX
260
                ( "rule_id = ?"
261
                , "file = ?"
262
                , "line = ?"
263
                ))
264
            ->setParameter(0, $this->current_rule_id)
265
            ->setParameter(1, $violation->filename())
266
            ->setParameter(2, $violation->line())
267
            ->execute()
268
            ->fetch();
269
        if ($res) {
270
            return (int)$res["id"];
271
        }
272
        else {
273
            return null;
274
        }
275
    }
276
277
    // Names
278