PropertyQueryBehavior   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 18
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A hasProp() 0 15 3
1
<?php
2
/**
3
 * @author Nikola Kostadinov<[email protected]>
4
 * Date: 02.08.2016
5
 * Time: 09:11 ч.
6
 */
7
8
namespace nkostadinov\taxonomy\behaviors;
9
10
11
use nkostadinov\taxonomy\models\TaxonomyTerms;
12
13
class PropertyQueryBehavior extends BaseTermBehavior
14
{
15
    public function hasProp($name, $value = null)
16
    {
17
        $this->joinTables();
18
19
20
        if(!empty($name))
21
            $this->getQuery()
22
                ->andFilterWhere([ TaxonomyTerms::tableName() . '.term' => $name ]);
23
24
        if(!empty($value))
25
            $this->getQuery()
26
                ->andFilterWhere([ $this->taxonomy->table . '.value' => $value ]);
27
28
        return $this->getQuery();
29
    }
30
}