Completed
Push — develop ( e79554...8e0c94 )
by Jens
08:31
created

Facet   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 26
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A countingProducts() 0 6 1
A isCountingProducts() 0 4 1
A __toString() 0 8 2
1
<?php
2
/**
3
 * @author @jayS-de <[email protected]>
4
 */
5
6
namespace Commercetools\Core\Model\Product\Search;
7
8
/**
9
 * @package Commercetools\Core\Model\Product\Search
10
 */
11
class Facet extends Filter
12
{
13
    const COUNTING_PRODUCTS = 'counting products';
14
    private $countingProducts = false;
15
16 3
    public function countingProducts($counting = true)
17
    {
18 3
        $this->countingProducts = $counting;
19
20 3
        return $this;
21
    }
22
23 6
    public function isCountingProducts()
24
    {
25 6
        return $this->countingProducts;
26
    }
27
28 6
    public function __toString()
29
    {
30 6
        $str = parent::__toString();
31 6
        if ($this->isCountingProducts()) {
32 2
            $str .= ' ' . static::COUNTING_PRODUCTS;
33
        }
34 6
        return $str;
35
    }
36
}
37