Code Duplication    Length = 7-8 lines in 2 locations

components/terms/PropertyTerm.php 1 location

@@ 45-51 (lines=7) @@
42
    {
43
        foreach($params as $item => $value) {
44
            $term = TaxonomyTerms::findOne(['term' => $item, 'taxonomy_id' => $this->id]);
45
            if (!isset($term)) {
46
                $term = new TaxonomyTerms();
47
                $term->taxonomy_id = $this->id;
48
                $term->term = $item;
49
                $term->total_count = 0;
50
                $term->save();
51
            }
52
            $data['term_id'] = $term->id;
53
            $data['object_id'] = $object_id;
54

components/terms/BaseTerm.php 1 location

@@ 118-125 (lines=8) @@
115
    public function getTaxonomyTerm($name, $create = true)
116
    {
117
        $term = TaxonomyTerms::findOne(['term'=>$name, 'taxonomy_id' => $this->id]);
118
        if($create and !isset($term))
119
        {
120
            $term = new TaxonomyTerms();
121
            $term->taxonomy_id = $this->id;
122
            $term->term = $name;
123
            $term->total_count = 0;
124
            $term->save();
125
        }
126
        return $term;
127
    }
128