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

Facet::__toString()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 5
cts 5
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 0
crap 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