Term::getIterator()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Mdiyakov\DoctrineSolrBundle\Query\Suggest\Solarium\Result;
4
5
class Term implements \IteratorAggregate, \Countable
6
{
7
8
    /**
9
     * @var int
10
     */
11
    private $numFound;
12
13
    /**
14
     * @var array
15
     */
16
    private $suggestions;
17
18
    public function __construct($numFound, $suggestions)
19
    {
20
        $this->numFound = $numFound;
21
        $this->suggestions = $suggestions;
22
    }
23
24
25
    /**
26
     * IteratorAggregate implementation
27
     *
28
     * @return \ArrayIterator
29
     */
30
    public function getIterator()
31
    {
32
        return new \ArrayIterator($this->suggestions);
33
    }
34
35
    /**
36
     * Countable implementation
37
     *
38
     * @return int
39
     */
40
    public function count()
41
    {
42
        return count($this->suggestions);
43
    }
44
45
    /**
46
     * Get suggestions
47
     *
48
     * @return array
49
     */
50
    public function getSuggestions()
51
    {
52
        return $this->suggestions;
53
    }
54
55
}