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 | * Analysis item |
---|
41 | * |
---|
42 | * @package Solarium |
---|
43 | * @subpackage Result |
---|
44 | */ |
---|
45 | class Solarium_Result_Analysis_Item |
---|
46 | { |
---|
47 | |
---|
48 | /** |
---|
49 | * Text string |
---|
50 | * |
---|
51 | * @var string |
---|
52 | */ |
---|
53 | protected $_text; |
---|
54 | |
---|
55 | /** |
---|
56 | * RawText string |
---|
57 | * |
---|
58 | * @var string |
---|
59 | */ |
---|
60 | protected $_rawText; |
---|
61 | |
---|
62 | /** |
---|
63 | * Start |
---|
64 | * |
---|
65 | * @var int |
---|
66 | */ |
---|
67 | protected $_start; |
---|
68 | |
---|
69 | /** |
---|
70 | * End |
---|
71 | * |
---|
72 | * @var int |
---|
73 | */ |
---|
74 | protected $_end; |
---|
75 | |
---|
76 | /** |
---|
77 | * Position |
---|
78 | * |
---|
79 | * @var int |
---|
80 | */ |
---|
81 | protected $_position; |
---|
82 | |
---|
83 | /** |
---|
84 | * Position history |
---|
85 | * |
---|
86 | * @var array |
---|
87 | */ |
---|
88 | protected $_positionHistory; |
---|
89 | |
---|
90 | /** |
---|
91 | * Type |
---|
92 | * |
---|
93 | * @var string |
---|
94 | */ |
---|
95 | protected $_type; |
---|
96 | |
---|
97 | /** |
---|
98 | * Match |
---|
99 | * |
---|
100 | * @var boolean |
---|
101 | */ |
---|
102 | protected $_match = false; |
---|
103 | |
---|
104 | /** |
---|
105 | * Constructor |
---|
106 | * |
---|
107 | * @param array $analysis |
---|
108 | */ |
---|
109 | public function __construct($analysis) |
---|
110 | { |
---|
111 | $this->_text = $analysis['text']; |
---|
112 | $this->_start = $analysis['start']; |
---|
113 | $this->_end = $analysis['end']; |
---|
114 | $this->_position = $analysis['position']; |
---|
115 | $this->_positionHistory = $analysis['positionHistory']; |
---|
116 | $this->_type = $analysis['type']; |
---|
117 | |
---|
118 | if (isset($analysis['raw_text'])) { |
---|
119 | $this->_rawText = $analysis['raw_text']; |
---|
120 | } |
---|
121 | |
---|
122 | if (isset($analysis['match'])) { |
---|
123 | $this->_match = $analysis['match']; |
---|
124 | } |
---|
125 | } |
---|
126 | |
---|
127 | /** |
---|
128 | * Get text value |
---|
129 | * |
---|
130 | * @return string |
---|
131 | */ |
---|
132 | public function getText() |
---|
133 | { |
---|
134 | return $this->_text; |
---|
135 | } |
---|
136 | |
---|
137 | /** |
---|
138 | * Get raw text value |
---|
139 | * |
---|
140 | * This values is not available in all cases |
---|
141 | * |
---|
142 | * @return string |
---|
143 | */ |
---|
144 | public function getRawText() |
---|
145 | { |
---|
146 | return $this->_rawText; |
---|
147 | } |
---|
148 | |
---|
149 | /** |
---|
150 | * Get start value |
---|
151 | * |
---|
152 | * @return int |
---|
153 | */ |
---|
154 | public function getStart() |
---|
155 | { |
---|
156 | return $this->_start; |
---|
157 | } |
---|
158 | |
---|
159 | /** |
---|
160 | * Get end value |
---|
161 | * |
---|
162 | * @return int |
---|
163 | */ |
---|
164 | public function getEnd() |
---|
165 | { |
---|
166 | return $this->_end; |
---|
167 | } |
---|
168 | |
---|
169 | /** |
---|
170 | * Get postion value |
---|
171 | * |
---|
172 | * @return int |
---|
173 | */ |
---|
174 | public function getPosition() |
---|
175 | { |
---|
176 | return $this->_position; |
---|
177 | } |
---|
178 | |
---|
179 | /** |
---|
180 | * Get position history value |
---|
181 | * |
---|
182 | * @return array |
---|
183 | */ |
---|
184 | public function getPositionHistory() |
---|
185 | { |
---|
186 | return $this->_positionHistory; |
---|
187 | } |
---|
188 | |
---|
189 | /** |
---|
190 | * Get type value |
---|
191 | * |
---|
192 | * @return string |
---|
193 | */ |
---|
194 | public function getType() |
---|
195 | { |
---|
196 | return $this->_type; |
---|
197 | } |
---|
198 | |
---|
199 | /** |
---|
200 | * Get match value |
---|
201 | * |
---|
202 | * @return boolean |
---|
203 | */ |
---|
204 | public function getMatch() |
---|
205 | { |
---|
206 | return $this->_match; |
---|
207 | } |
---|
208 | |
---|
209 | } |
---|