1 | <?php |
---|
2 | /** |
---|
3 | * Copyright 2011 Bas de Nooijer. All rights reserved. |
---|
4 | * |
---|
5 | * Redistribution and use in source and binary forms, with or without |
---|
6 | * modification, are permitted provided that the following conditions are met: |
---|
7 | * |
---|
8 | * 1. Redistributions of source code must retain the above copyright notice, |
---|
9 | * this list of conditions and the following disclaimer. |
---|
10 | * |
---|
11 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
---|
12 | * this listof conditions and the following disclaimer in the documentation |
---|
13 | * and/or other materials provided with the distribution. |
---|
14 | * |
---|
15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS" |
---|
16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
---|
19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
---|
25 | * POSSIBILITY OF SUCH DAMAGE. |
---|
26 | * |
---|
27 | * The views and conclusions contained in the software and documentation are |
---|
28 | * those of the authors and should not be interpreted as representing official |
---|
29 | * policies, either expressed or implied, of the copyright holder. |
---|
30 | * |
---|
31 | * @copyright Copyright 2011 Bas de Nooijer <solarium@raspberry.nl> |
---|
32 | * @license http://github.com/basdenooijer/solarium/raw/master/COPYING |
---|
33 | * @link http://www.solarium-project.org/ |
---|
34 | * |
---|
35 | * @package Solarium |
---|
36 | * @subpackage Result |
---|
37 | */ |
---|
38 | |
---|
39 | /** |
---|
40 | * Select component debug result |
---|
41 | * |
---|
42 | * @package Solarium |
---|
43 | * @subpackage Result |
---|
44 | */ |
---|
45 | class Solarium_Result_Select_Debug implements IteratorAggregate, Countable |
---|
46 | { |
---|
47 | |
---|
48 | /** |
---|
49 | * QueryString |
---|
50 | * |
---|
51 | * @var string |
---|
52 | */ |
---|
53 | protected $_queryString; |
---|
54 | |
---|
55 | /** |
---|
56 | * ParsedQuery |
---|
57 | * |
---|
58 | * @var string |
---|
59 | */ |
---|
60 | protected $_parsedQuery; |
---|
61 | |
---|
62 | /** |
---|
63 | * QueryParser |
---|
64 | * |
---|
65 | * @var string |
---|
66 | */ |
---|
67 | protected $_queryParser; |
---|
68 | |
---|
69 | /** |
---|
70 | * OtherQuery |
---|
71 | * |
---|
72 | * @var string |
---|
73 | */ |
---|
74 | protected $_otherQuery; |
---|
75 | |
---|
76 | /** |
---|
77 | * Explain instance |
---|
78 | * |
---|
79 | * @var Solarium_Result_Select_Debug_DocumentSet |
---|
80 | */ |
---|
81 | protected $_explain; |
---|
82 | |
---|
83 | /** |
---|
84 | * ExplainOther instance |
---|
85 | * |
---|
86 | * @var Solarium_Result_Select_Debug_DocumentSet |
---|
87 | */ |
---|
88 | protected $_explainOther; |
---|
89 | |
---|
90 | /** |
---|
91 | * Timing instance |
---|
92 | * |
---|
93 | * @var Solarium_Result_Select_Debug_Timing |
---|
94 | */ |
---|
95 | protected $_timing; |
---|
96 | |
---|
97 | /** |
---|
98 | * Constructor |
---|
99 | * |
---|
100 | * @param string $queryString |
---|
101 | * @param string $parsedQuery |
---|
102 | * @param string $queryParser |
---|
103 | * @param string $otherQuery |
---|
104 | * @param Solarium_Result_Select_Debug_DocumentSet $explain |
---|
105 | * @param Solarium_Result_Select_Debug_DocumentSet $explainOther |
---|
106 | * @param Solarium_Result_Select_Debug_Timing $timing |
---|
107 | */ |
---|
108 | public function __construct($queryString, $parsedQuery, $queryParser, $otherQuery, $explain, $explainOther, $timing) |
---|
109 | { |
---|
110 | $this->_queryString = $queryString; |
---|
111 | $this->_parsedQuery = $parsedQuery; |
---|
112 | $this->_queryParser = $queryParser; |
---|
113 | $this->_otherQuery = $otherQuery; |
---|
114 | $this->_explain = $explain; |
---|
115 | $this->_explainOther = $explainOther; |
---|
116 | $this->_timing = $timing; |
---|
117 | } |
---|
118 | |
---|
119 | /** |
---|
120 | * Get input querystring |
---|
121 | * |
---|
122 | * @return string |
---|
123 | */ |
---|
124 | public function getQueryString() |
---|
125 | { |
---|
126 | return $this->_queryString; |
---|
127 | } |
---|
128 | |
---|
129 | /** |
---|
130 | * Get the result of the queryparser |
---|
131 | * |
---|
132 | * @return string |
---|
133 | */ |
---|
134 | public function getParsedQuery() |
---|
135 | { |
---|
136 | return $this->_parsedQuery; |
---|
137 | } |
---|
138 | |
---|
139 | /** |
---|
140 | * Get the used queryparser |
---|
141 | * |
---|
142 | * @return string |
---|
143 | */ |
---|
144 | public function getQueryParser() |
---|
145 | { |
---|
146 | return $this->_queryParser; |
---|
147 | } |
---|
148 | |
---|
149 | /** |
---|
150 | * Get other query (only available if set in query) |
---|
151 | * |
---|
152 | * @return string |
---|
153 | */ |
---|
154 | public function getOtherQuery() |
---|
155 | { |
---|
156 | return $this->_otherQuery; |
---|
157 | } |
---|
158 | |
---|
159 | /** |
---|
160 | * Get explain document set |
---|
161 | * |
---|
162 | * @return Solarium_Result_Select_Debug_DocumentSet |
---|
163 | */ |
---|
164 | public function getExplain() |
---|
165 | { |
---|
166 | return $this->_explain; |
---|
167 | } |
---|
168 | |
---|
169 | /** |
---|
170 | * Get explain other document set (only available if otherquery was set in query) |
---|
171 | * |
---|
172 | * @return Solarium_Result_Select_Debug_DocumentSet |
---|
173 | */ |
---|
174 | public function getExplainOther() |
---|
175 | { |
---|
176 | return $this->_explainOther; |
---|
177 | } |
---|
178 | |
---|
179 | /** |
---|
180 | * Get timing object |
---|
181 | * |
---|
182 | * @return Solarium_Result_Select_Debug_Timing |
---|
183 | */ |
---|
184 | public function getTiming() |
---|
185 | { |
---|
186 | return $this->_timing; |
---|
187 | } |
---|
188 | |
---|
189 | /** |
---|
190 | * IteratorAggregate implementation |
---|
191 | * |
---|
192 | * Iterates the explain results |
---|
193 | * |
---|
194 | * @return Solarium_Result_Select_Debug_DocumentSet |
---|
195 | */ |
---|
196 | public function getIterator() |
---|
197 | { |
---|
198 | return $this->_explain; |
---|
199 | } |
---|
200 | |
---|
201 | /** |
---|
202 | * Countable implementation |
---|
203 | * |
---|
204 | * @return int |
---|
205 | */ |
---|
206 | public function count() |
---|
207 | { |
---|
208 | return count($this->_explain); |
---|
209 | } |
---|
210 | |
---|
211 | } |
---|