Code Duplication    Length = 14-14 lines in 2 locations

src/Report/Queries.php 2 locations

@@ 116-129 (lines=14) @@
113
     * @param   int $run
114
     * @return  array<string,string>     with keys 'commit_hash'
115
     */
116
    public function run_info($run) {
117
        $b = $this->result_db->builder();
118
        $res = $b
119
            ->select("commit_hash")
120
            ->from("runs")
121
            ->where("id = ?")
122
            ->setParameter(0, $run)
123
            ->execute()
124
            ->fetch();
125
        if ($res) {
126
            return $res;
127
        }
128
        throw new \RuntimeException("Result database contains no run with id '$run'.");
129
    }
130
131
    /**
132
     * Get the amount of violations in a run.
@@ 265-278 (lines=14) @@
262
     * @param   int $rule
263
     * @return  array<string,string>    with keys 'rule', 'explanation'
264
     */
265
    public function rule_info($rule) {
266
        $b = $this->result_db->builder();
267
        $res = $b
268
            ->select("rule", "explanation")
269
            ->from("rules")
270
            ->where("rules.id = ?")
271
            ->setParameter(0, $rule)
272
            ->execute()
273
            ->fetch();
274
        if ($res) {
275
            return $res;
276
        }
277
        throw new \RuntimeException("Result database contains no rule with id '$rule'.");
278
    }
279
280
    /**
281
     * Get the violations of a rule.