Code Duplication    Length = 8-8 lines in 2 locations

components/terms/CategoryTerm.php 2 locations

@@ 33-40 (lines=8) @@
30
            $data['object_id'] = $object_id;
31
32
            if (!(new Query())->from($this->table)->where($data)->exists(CategoryTerm::getDb())) {
33
                Yii::$app->db->transaction(function() use ($data, $term, &$result) {
34
                    CategoryTerm::getDb()->createCommand()->insert($this->table, $data)->execute();
35
36
                    $term->updateCounters(['total_count' => 1]);
37
                    TaxonomyDef::updateAllCounters(['total_count' => 1], ['id' => $this->id]);
38
39
                    $result[] = $term;
40
                });
41
            }
42
        }
43
@@ 64-71 (lines=8) @@
61
62
            $query = new Query();
63
            if ($query->from($this->table)->where($data)->exists($this->getDb())) {
64
                Yii::$app->db->transaction(function() use ($data, $term, &$result) {
65
                    $this->getDb()->createCommand()->delete($this->table, $data)->execute();
66
67
                    $term->updateCounters(['total_count' => -1]);
68
                    Taxonomydef::updateAllCounters(['total_count' => -1], ['id' => $this->id]);
69
70
                    $result[] = $term;
71
                });
72
            }
73
        }
74