Completed
Push — master ( 5decb7...aee104 )
by Thibaud
14:37 queued 11:26
created

QueryFacetValue   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 71
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 73.68%

Importance

Changes 4
Bugs 0 Features 0
Metric Value
wmc 8
c 4
b 0
f 0
lcom 0
cbo 0
dl 0
loc 71
ccs 14
cts 19
cp 0.7368
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A fromList() 0 10 2
A fromValue() 0 4 1
A __construct() 0 4 1
A getValue() 0 4 1
A getCount() 0 4 1
A getRawData() 0 4 1
A getQuery() 0 4 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
    public function getRawData()
48
    {
49
        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 1
    public function getQuery()
72
    {
73 1
        return $this->source->query;
74
    }
75
}
76