Total Complexity | 7 |
Total Lines | 113 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
7 | class Result extends BaseResult implements \IteratorAggregate, \Countable |
||
8 | { |
||
9 | /** |
||
10 | * Status code returned by Solr |
||
11 | * |
||
12 | * @var int |
||
13 | */ |
||
14 | protected $status; |
||
15 | |||
16 | /** |
||
17 | * Solr index queryTime |
||
18 | * |
||
19 | * This doesn't include things like the HTTP responsetime. Purely the Solr |
||
20 | * query execution time. |
||
21 | * |
||
22 | * @var int |
||
23 | */ |
||
24 | protected $queryTime; |
||
25 | |||
26 | /** |
||
27 | * Suggester results |
||
28 | * |
||
29 | * @var array |
||
30 | */ |
||
31 | protected $results; |
||
32 | |||
33 | /** |
||
34 | * Suggester flat results |
||
35 | * |
||
36 | * @var array |
||
37 | */ |
||
38 | protected $all; |
||
39 | |||
40 | /** |
||
41 | * Get Solr status code |
||
42 | * |
||
43 | * This is not the HTTP status code! The normal value for success is 0. |
||
44 | * |
||
45 | * @return int |
||
46 | */ |
||
47 | public function getStatus() |
||
48 | { |
||
49 | $this->parseResponse(); |
||
50 | |||
51 | return $this->status; |
||
52 | } |
||
53 | |||
54 | /** |
||
55 | * Get Solr query time |
||
56 | * |
||
57 | * This doesn't include things like the HTTP responsetime. Purely the Solr |
||
58 | * query execution time. |
||
59 | * |
||
60 | * @return int |
||
61 | */ |
||
62 | public function getQueryTime() |
||
63 | { |
||
64 | $this->parseResponse(); |
||
65 | |||
66 | return $this->queryTime; |
||
67 | } |
||
68 | |||
69 | /** |
||
70 | * Get all results |
||
71 | * |
||
72 | * @return array |
||
73 | */ |
||
74 | public function getResults() |
||
75 | { |
||
76 | $this->parseResponse(); |
||
77 | |||
78 | return $this->results; |
||
79 | } |
||
80 | |||
81 | /** |
||
82 | * Get results for a specific term |
||
83 | * |
||
84 | * @param string $term |
||
85 | * @return array |
||
86 | */ |
||
87 | public function getTerm($term) |
||
95 | } |
||
96 | } |
||
97 | |||
98 | /** |
||
99 | * IteratorAggregate implementation |
||
100 | * |
||
101 | * @return \ArrayIterator |
||
102 | */ |
||
103 | public function getIterator() |
||
104 | { |
||
105 | $this->parseResponse(); |
||
106 | |||
107 | return new \ArrayIterator($this->results); |
||
108 | } |
||
109 | |||
110 | /** |
||
111 | * Countable implementation |
||
112 | * |
||
113 | * @return int |
||
114 | */ |
||
115 | public function count() |
||
120 | } |
||
121 | } |