Completed
Push — master ( 874d6a...5decb7 )
by Thibaud
10s
created

QueryFacetValue::getCount()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 3
Bugs 0 Features 0
Metric Value
c 3
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace PhraseanetSDK\Entity;
4
5
class QueryFacetValue
6
{
7
    /**
8
     * @param \stdClass[] $values
9
     * @return QueryFacetValue[]
10
     */
11 1
    public static function fromList(array $values)
12
    {
13 1
        $facetValues = array();
14
15 1
        foreach ($values as $value) {
16
            $facetValues[] = self::fromValue($value);
17 1
        }
18
19 1
        return $facetValues;
20
    }
21
22
    /**
23
     * @param \stdClass $value
24
     * @return QueryFacetValue
25
     */
26
    public static function fromValue(\stdClass $value)
27
    {
28
        return new self($value);
29
    }
30
31
    /**
32
     * @var \stdClass
33
     */
34
    protected $source;
35
36
    /**
37
     * @param \stdClass $source
38
     */
39 1
    public function __construct(\stdClass $source)
40
    {
41 1
        $this->source = $source;
42 1
    }
43
44
    /**
45
     * @return \stdClass
46
     */
47 1
    public function getRawData()
48
    {
49 1
        return $this->source;
50
    }
51
52
    /**
53
     * @return string
54
     */
55 1
    public function getValue()
56
    {
57 1
        return $this->source->value;
58
    }
59
60
    /**
61
     * @return int
62
     */
63 1
    public function getCount()
64
    {
65 1
        return $this->source->count;
66
    }
67
68
    /**
69
     * @return string
70
     */
71
    public function getQuery()
72
    {
73
        return $this->source->query;
74
    }
75
}
76