Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( b34a1c...06de54 )
by Sebastian
03:26 queued 50s
created
dlf/lib/SolrPhpClient/Apache/Solr/Document.php 1 patch
Braces   +28 added lines, -60 removed lines patch added patch discarded remove patch
@@ -55,8 +55,7 @@  discard block
 block discarded – undo
55 55
  * }
56 56
  * </code>
57 57
  */
58
-class Apache_Solr_Document implements IteratorAggregate
59
-{
58
+class Apache_Solr_Document implements IteratorAggregate {
60 59
 	/**
61 60
 	 * SVN Revision meta data for this class
62 61
 	 */
@@ -91,8 +90,7 @@  discard block
 block discarded – undo
91 90
 	/**
92 91
 	 * Clear all boosts and fields from this document
93 92
 	 */
94
-	public function clear()
95
-	{
93
+	public function clear() {
96 94
 		$this->_documentBoost = false;
97 95
 
98 96
 		$this->_fields = array();
@@ -104,8 +102,7 @@  discard block
 block discarded – undo
104 102
 	 *
105 103
 	 * @return mixed will be false for default, or else a float
106 104
 	 */
107
-	public function getBoost()
108
-	{
105
+	public function getBoost() {
109 106
 		return $this->_documentBoost;
110 107
 	}
111 108
 
@@ -114,16 +111,12 @@  discard block
 block discarded – undo
114 111
 	 *
115 112
 	 * @param mixed $boost Use false for default boost, else cast to float that should be > 0 or will be treated as false
116 113
 	 */
117
-	public function setBoost($boost)
118
-	{
114
+	public function setBoost($boost) {
119 115
 		$boost = (float) $boost;
120 116
 
121
-		if ($boost > 0.0)
122
-		{
117
+		if ($boost > 0.0) {
123 118
 			$this->_documentBoost = $boost;
124
-		}
125
-		else
126
-		{
119
+		} else {
127 120
 			$this->_documentBoost = false;
128 121
 		}
129 122
 	}
@@ -151,26 +144,19 @@  discard block
 block discarded – undo
151 144
 	 * @param mixed $value
152 145
 	 * @param mixed $boost Use false for default boost, else cast to float that should be > 0 or will be treated as false
153 146
 	 */
154
-	public function addField($key, $value, $boost = false)
155
-	{
156
-		if (!isset($this->_fields[$key]))
157
-		{
147
+	public function addField($key, $value, $boost = false) {
148
+		if (!isset($this->_fields[$key])) {
158 149
 			// create holding array if this is the first value
159 150
 			$this->_fields[$key] = array();
160
-		}
161
-		else if (!is_array($this->_fields[$key]))
162
-		{
151
+		} else if (!is_array($this->_fields[$key])) {
163 152
 			// move existing value into array if it is not already an array
164 153
 			$this->_fields[$key] = array($this->_fields[$key]);
165 154
 		}
166 155
 
167
-		if ($this->getFieldBoost($key) === false)
168
-		{
156
+		if ($this->getFieldBoost($key) === false) {
169 157
 			// boost not already set, set it now
170 158
 			$this->setFieldBoost($key, $boost);
171
-		}
172
-		else if ((float) $boost > 0.0)
173
-		{
159
+		} else if ((float) $boost > 0.0) {
174 160
 			// multiply passed boost with current field boost - similar to SolrJ implementation
175 161
 			$this->_fieldBoosts[$key] *= (float) $boost;
176 162
 		}
@@ -188,8 +174,7 @@  discard block
 block discarded – undo
188 174
 	 *
189 175
 	 * @deprecated Use addField(...) instead
190 176
 	 */
191
-	public function setMultiValue($key, $value, $boost = false)
192
-	{
177
+	public function setMultiValue($key, $value, $boost = false) {
193 178
 		$this->addField($key, $value, $boost);
194 179
 	}
195 180
 
@@ -199,10 +184,8 @@  discard block
 block discarded – undo
199 184
 	 * @param string $key
200 185
 	 * @return mixed associative array of info if field exists, false otherwise
201 186
 	 */
202
-	public function getField($key)
203
-	{
204
-		if (isset($this->_fields[$key]))
205
-		{
187
+	public function getField($key) {
188
+		if (isset($this->_fields[$key])) {
206 189
 			return array(
207 190
 				'name' => $key,
208 191
 				'value' => $this->_fields[$key],
@@ -222,8 +205,7 @@  discard block
 block discarded – undo
222 205
 	 * @param mixed $value
223 206
 	 * @param mixed $boost Use false for default boost, else cast to float that should be > 0 or will be treated as false
224 207
 	 */
225
-	public function setField($key, $value, $boost = false)
226
-	{
208
+	public function setField($key, $value, $boost = false) {
227 209
 		$this->_fields[$key] = $value;
228 210
 		$this->setFieldBoost($key, $boost);
229 211
 	}
@@ -234,8 +216,7 @@  discard block
 block discarded – undo
234 216
 	 * @param string $key
235 217
 	 * @return float currently set field boost, false if one is not set
236 218
 	 */
237
-	public function getFieldBoost($key)
238
-	{
219
+	public function getFieldBoost($key) {
239 220
 		return isset($this->_fieldBoosts[$key]) ? $this->_fieldBoosts[$key] : false;
240 221
 	}
241 222
 
@@ -245,16 +226,12 @@  discard block
 block discarded – undo
245 226
 	 * @param string $key field name for the boost
246 227
 	 * @param mixed $boost Use false for default boost, else cast to float that should be > 0 or will be treated as false
247 228
 	 */
248
-	public function setFieldBoost($key, $boost)
249
-	{
229
+	public function setFieldBoost($key, $boost) {
250 230
 		$boost = (float) $boost;
251 231
 
252
-		if ($boost > 0.0)
253
-		{
232
+		if ($boost > 0.0) {
254 233
 			$this->_fieldBoosts[$key] = $boost;
255
-		}
256
-		else
257
-		{
234
+		} else {
258 235
 			$this->_fieldBoosts[$key] = false;
259 236
 		}
260 237
 	}
@@ -264,8 +241,7 @@  discard block
 block discarded – undo
264 241
 	 *
265 242
 	 * @return array
266 243
 	 */
267
-	public function getFieldBoosts()
268
-	{
244
+	public function getFieldBoosts() {
269 245
 		return $this->_fieldBoosts;
270 246
 	}
271 247
 
@@ -274,8 +250,7 @@  discard block
 block discarded – undo
274 250
 	 *
275 251
 	 * @return array
276 252
 	 */
277
-	public function getFieldNames()
278
-	{
253
+	public function getFieldNames() {
279 254
 		return array_keys($this->_fields);
280 255
 	}
281 256
 
@@ -284,8 +259,7 @@  discard block
 block discarded – undo
284 259
 	 *
285 260
 	 * @return array
286 261
 	 */
287
-	public function getFieldValues()
288
-	{
262
+	public function getFieldValues() {
289 263
 		return array_values($this->_fields);
290 264
 	}
291 265
 
@@ -299,8 +273,7 @@  discard block
 block discarded – undo
299 273
 	 * }
300 274
 	 * </code>
301 275
 	 */
302
-	public function getIterator()
303
-	{
276
+	public function getIterator() {
304 277
 		$arrayObject = new ArrayObject($this->_fields);
305 278
 
306 279
 		return $arrayObject->getIterator();
@@ -312,10 +285,8 @@  discard block
 block discarded – undo
312 285
 	 * @param string $key
313 286
 	 * @return mixed
314 287
 	 */
315
-	public function __get($key)
316
-	{
317
-		if (isset($this->_fields[$key]))
318
-		{
288
+	public function __get($key) {
289
+		if (isset($this->_fields[$key])) {
319 290
 			return $this->_fields[$key];
320 291
 		}
321 292
 		
@@ -330,8 +301,7 @@  discard block
 block discarded – undo
330 301
 	 * @param string $key
331 302
 	 * @param mixed $value
332 303
 	 */
333
-	public function __set($key, $value)
334
-	{
304
+	public function __set($key, $value) {
335 305
 		$this->setField($key, $value);
336 306
 	}
337 307
 
@@ -345,8 +315,7 @@  discard block
 block discarded – undo
345 315
 	 * @param string $key
346 316
 	 * @return boolean
347 317
 	 */
348
-	public function __isset($key)
349
-	{
318
+	public function __isset($key) {
350 319
 		return isset($this->_fields[$key]);
351 320
 	}
352 321
 
@@ -359,8 +328,7 @@  discard block
 block discarded – undo
359 328
 	 *
360 329
 	 * @param string $key
361 330
 	 */
362
-	public function __unset($key)
363
-	{
331
+	public function __unset($key) {
364 332
 		unset($this->_fields[$key]);
365 333
 		unset($this->_fieldBoosts[$key]);
366 334
 	}
Please login to merge, or discard this patch.
dlf/lib/SolrPhpClient/Apache/Solr/InvalidArgumentException.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,8 +36,7 @@
 block discarded – undo
36 36
  * @author Donovan Jimenez <[email protected]>
37 37
  */
38 38
 
39
-class Apache_Solr_InvalidArgumentException extends Apache_Solr_Exception
40
-{
39
+class Apache_Solr_InvalidArgumentException extends Apache_Solr_Exception {
41 40
 	/**
42 41
 	 * SVN Revision meta data for this class
43 42
 	 */
Please login to merge, or discard this patch.
dlf/lib/SolrPhpClient/Apache/Solr/NoServiceAvailableException.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,8 +36,7 @@
 block discarded – undo
36 36
  * @author Donovan Jimenez <[email protected]>
37 37
  */
38 38
 
39
-class Apache_Solr_NoServiceAvailableException extends Apache_Solr_Exception
40
-{
39
+class Apache_Solr_NoServiceAvailableException extends Apache_Solr_Exception {
41 40
 	/**
42 41
 	 * SVN Revision meta data for this class
43 42
 	 */
Please login to merge, or discard this patch.
dlf/lib/SolrPhpClient/Apache/Solr/Service/Balancer.php 1 patch
Braces   +143 added lines, -251 removed lines patch added patch discarded remove patch
@@ -48,8 +48,7 @@  discard block
 block discarded – undo
48 48
  * 	routing of read / write operations
49 49
  * 	failover (on selection) for multiple read servers
50 50
  */
51
-class Apache_Solr_Service_Balancer
52
-{
51
+class Apache_Solr_Service_Balancer {
53 52
 	/**
54 53
 	 * SVN Revision meta data for this class
55 54
 	 */
@@ -85,8 +84,7 @@  discard block
 block discarded – undo
85 84
 	 * @param string $value
86 85
 	 * @return string
87 86
 	 */
88
-	static public function escape($value)
89
-	{
87
+	static public function escape($value) {
90 88
 		return Apache_Solr_Service::escape($value);
91 89
 	}
92 90
 
@@ -96,8 +94,7 @@  discard block
 block discarded – undo
96 94
 	 * @param string $value
97 95
 	 * @return string
98 96
 	 */
99
-	static public function escapePhrase($value)
100
-	{
97
+	static public function escapePhrase($value) {
101 98
 		return Apache_Solr_Service::escapePhrase($value);
102 99
 	}
103 100
 
@@ -107,8 +104,7 @@  discard block
 block discarded – undo
107 104
 	 * @param string $value
108 105
 	 * @return string
109 106
 	 */
110
-	static public function phrase($value)
111
-	{
107
+	static public function phrase($value) {
112 108
 		return Apache_Solr_Service::phrase($value);
113 109
 	}
114 110
 
@@ -118,33 +114,27 @@  discard block
 block discarded – undo
118 114
 	 * @param array $readableServices
119 115
 	 * @param array $writeableServices
120 116
 	 */
121
-	public function __construct($readableServices = array(), $writeableServices = array())
122
-	{
117
+	public function __construct($readableServices = array(), $writeableServices = array()) {
123 118
 		//setup readable services
124
-		foreach ($readableServices as $service)
125
-		{
119
+		foreach ($readableServices as $service) {
126 120
 			$this->addReadService($service);
127 121
 		}
128 122
 
129 123
 		//setup writeable services
130
-		foreach ($writeableServices as $service)
131
-		{
124
+		foreach ($writeableServices as $service) {
132 125
 			$this->addWriteService($service);
133 126
 		}
134 127
 	}
135 128
 
136
-	public function setReadPingTimeout($timeout)
137
-	{
129
+	public function setReadPingTimeout($timeout) {
138 130
 		$this->_readPingTimeout = $timeout;
139 131
 	}
140 132
 
141
-	public function setWritePingTimeout($timeout)
142
-	{
133
+	public function setWritePingTimeout($timeout) {
143 134
 		$this->_writePingTimeout = $timeout;
144 135
 	}
145 136
 
146
-	public function setUseBackoff($enable)
147
-	{
137
+	public function setUseBackoff($enable) {
148 138
 		$this->_useBackoff = $enable;
149 139
 	}
150 140
 
@@ -156,8 +146,7 @@  discard block
 block discarded – undo
156 146
 	 * @param string $path
157 147
 	 * @return string
158 148
 	 */
159
-	protected function _getServiceId($host, $port, $path)
160
-	{
149
+	protected function _getServiceId($host, $port, $path) {
161 150
 		return $host . ':' . $port . $path;
162 151
 	}
163 152
 
@@ -169,24 +158,17 @@  discard block
 block discarded – undo
169 158
 	 *
170 159
 	 * @throws Apache_Solr_InvalidArgumentException If service descriptor is not valid
171 160
 	 */
172
-	public function addReadService($service)
173
-	{
174
-		if ($service instanceof Apache_Solr_Service)
175
-		{
161
+	public function addReadService($service) {
162
+		if ($service instanceof Apache_Solr_Service) {
176 163
 			$id = $this->_getServiceId($service->getHost(), $service->getPort(), $service->getPath());
177 164
 
178 165
 			$this->_readableServices[$id] = $service;
179
-		}
180
-		else if (is_array($service))
181
-		{
182
-			if (isset($service['host']) && isset($service['port']) && isset($service['path']))
183
-			{
166
+		} else if (is_array($service)) {
167
+			if (isset($service['host']) && isset($service['port']) && isset($service['path'])) {
184 168
 				$id = $this->_getServiceId((string)$service['host'], (int)$service['port'], (string)$service['path']);
185 169
 
186 170
 				$this->_readableServices[$id] = $service;
187
-			}
188
-			else
189
-			{
171
+			} else {
190 172
 				throw new Apache_Solr_InvalidArgumentException('A Readable Service description array does not have all required elements of host, port, and path');
191 173
 			}
192 174
 		}
@@ -199,32 +181,22 @@  discard block
 block discarded – undo
199 181
 	 *
200 182
 	 * @throws Apache_Solr_InvalidArgumentException If service descriptor is not valid
201 183
 	 */
202
-	public function removeReadService($service)
203
-	{
184
+	public function removeReadService($service) {
204 185
 		$id = '';
205 186
 
206
-		if ($service instanceof Apache_Solr_Service)
207
-		{
187
+		if ($service instanceof Apache_Solr_Service) {
208 188
 			$id = $this->_getServiceId($service->getHost(), $service->getPort(), $service->getPath());
209
-		}
210
-		else if (is_array($service))
211
-		{
212
-			if (isset($service['host']) && isset($service['port']) && isset($service['path']))
213
-			{
189
+		} else if (is_array($service)) {
190
+			if (isset($service['host']) && isset($service['port']) && isset($service['path'])) {
214 191
 				$id = $this->_getServiceId((string)$service['host'], (int)$service['port'], (string)$service['path']);
215
-			}
216
-			else
217
-			{
192
+			} else {
218 193
 				throw new Apache_Solr_InvalidArgumentException('A Readable Service description array does not have all required elements of host, port, and path');
219 194
 			}
220
-		}
221
-		else if (is_string($service))
222
-		{
195
+		} else if (is_string($service)) {
223 196
 			$id = $service;
224 197
 		}
225 198
 
226
-		if ($id && isset($this->_readableServices[$id]))
227
-		{
199
+		if ($id && isset($this->_readableServices[$id])) {
228 200
 			unset($this->_readableServices[$id]);
229 201
 		}
230 202
 	}
@@ -237,24 +209,17 @@  discard block
 block discarded – undo
237 209
 	 *
238 210
 	 * @throws Apache_Solr_InvalidArgumentException If service descriptor is not valid
239 211
 	 */
240
-	public function addWriteService($service)
241
-	{
242
-		if ($service instanceof Apache_Solr_Service)
243
-		{
212
+	public function addWriteService($service) {
213
+		if ($service instanceof Apache_Solr_Service) {
244 214
 			$id = $this->_getServiceId($service->getHost(), $service->getPort(), $service->getPath());
245 215
 
246 216
 			$this->_writeableServices[$id] = $service;
247
-		}
248
-		else if (is_array($service))
249
-		{
250
-			if (isset($service['host']) && isset($service['port']) && isset($service['path']))
251
-			{
217
+		} else if (is_array($service)) {
218
+			if (isset($service['host']) && isset($service['port']) && isset($service['path'])) {
252 219
 				$id = $this->_getServiceId((string)$service['host'], (int)$service['port'], (string)$service['path']);
253 220
 
254 221
 				$this->_writeableServices[$id] = $service;
255
-			}
256
-			else
257
-			{
222
+			} else {
258 223
 				throw new Apache_Solr_InvalidArgumentException('A Writeable Service description array does not have all required elements of host, port, and path');
259 224
 			}
260 225
 		}
@@ -267,32 +232,22 @@  discard block
 block discarded – undo
267 232
 	 *
268 233
 	 * @throws Apache_Solr_InvalidArgumentException If service descriptor is not valid
269 234
 	 */
270
-	public function removeWriteService($service)
271
-	{
235
+	public function removeWriteService($service) {
272 236
 		$id = '';
273 237
 
274
-		if ($service instanceof Apache_Solr_Service)
275
-		{
238
+		if ($service instanceof Apache_Solr_Service) {
276 239
 			$id = $this->_getServiceId($service->getHost(), $service->getPort(), $service->getPath());
277
-		}
278
-		else if (is_array($service))
279
-		{
280
-			if (isset($service['host']) && isset($service['port']) && isset($service['path']))
281
-			{
240
+		} else if (is_array($service)) {
241
+			if (isset($service['host']) && isset($service['port']) && isset($service['path'])) {
282 242
 				$id = $this->_getServiceId((string)$service['host'], (int)$service['port'], (string)$service['path']);
283
-			}
284
-			else
285
-			{
243
+			} else {
286 244
 				throw new Apache_Solr_InvalidArgumentException('A Readable Service description array does not have all required elements of host, port, and path');
287 245
 			}
288
-		}
289
-		else if (is_string($service))
290
-		{
246
+		} else if (is_string($service)) {
291 247
 			$id = $service;
292 248
 		}
293 249
 
294
-		if ($id && isset($this->_writeableServices[$id]))
295
-		{
250
+		if ($id && isset($this->_writeableServices[$id])) {
296 251
 			unset($this->_writeableServices[$id]);
297 252
 		}
298 253
 	}
@@ -305,29 +260,23 @@  discard block
 block discarded – undo
305 260
 	 *
306 261
 	 * @throws Apache_Solr_NoServiceAvailableException If there are no read services that meet requirements
307 262
 	 */
308
-	protected function _selectReadService($forceSelect = false)
309
-	{
310
-		if (!$this->_currentReadService || !isset($this->_readableServices[$this->_currentReadService]) || $forceSelect)
311
-		{
312
-			if ($this->_currentReadService && isset($this->_readableServices[$this->_currentReadService]) && $forceSelect)
313
-			{
263
+	protected function _selectReadService($forceSelect = false) {
264
+		if (!$this->_currentReadService || !isset($this->_readableServices[$this->_currentReadService]) || $forceSelect) {
265
+			if ($this->_currentReadService && isset($this->_readableServices[$this->_currentReadService]) && $forceSelect) {
314 266
 				// we probably had a communication error, ping the current read service, remove it if it times out
315
-				if ($this->_readableServices[$this->_currentReadService]->ping($this->_readPingTimeout) === false)
316
-				{
267
+				if ($this->_readableServices[$this->_currentReadService]->ping($this->_readPingTimeout) === false) {
317 268
 					$this->removeReadService($this->_currentReadService);
318 269
 				}
319 270
 			}
320 271
 
321
-			if (count($this->_readableServices))
322
-			{
272
+			if (count($this->_readableServices)) {
323 273
 				// select one of the read services at random
324 274
 				$ids = array_keys($this->_readableServices);
325 275
 
326 276
 				$id = $ids[rand(0, count($ids) - 1)];
327 277
 				$service = $this->_readableServices[$id];
328 278
 
329
-				if (is_array($service))
330
-				{
279
+				if (is_array($service)) {
331 280
 					//convert the array definition to a client object
332 281
 					$service = new Apache_Solr_Service($service['host'], $service['port'], $service['path']);
333 282
 					$this->_readableServices[$id] = $service;
@@ -335,9 +284,7 @@  discard block
 block discarded – undo
335 284
 
336 285
 				$service->setCreateDocuments($this->_createDocuments);
337 286
 				$this->_currentReadService = $id;
338
-			}
339
-			else
340
-			{
287
+			} else {
341 288
 				throw new Apache_Solr_NoServiceAvailableException('No read services were available');
342 289
 			}
343 290
 		}
@@ -353,43 +300,34 @@  discard block
 block discarded – undo
353 300
 	 *
354 301
 	 * @throws Apache_Solr_NoServiceAvailableException If there are no write services that meet requirements
355 302
 	 */
356
-	protected function _selectWriteService($forceSelect = false)
357
-	{
358
-		if($this->_useBackoff)
359
-		{
303
+	protected function _selectWriteService($forceSelect = false) {
304
+		if($this->_useBackoff) {
360 305
 			return $this->_selectWriteServiceSafe($forceSelect);
361 306
 		}
362 307
 
363
-		if (!$this->_currentWriteService || !isset($this->_writeableServices[$this->_currentWriteService]) || $forceSelect)
364
-		{
365
-			if ($this->_currentWriteService && isset($this->_writeableServices[$this->_currentWriteService]) && $forceSelect)
366
-			{
308
+		if (!$this->_currentWriteService || !isset($this->_writeableServices[$this->_currentWriteService]) || $forceSelect) {
309
+			if ($this->_currentWriteService && isset($this->_writeableServices[$this->_currentWriteService]) && $forceSelect) {
367 310
 				// we probably had a communication error, ping the current read service, remove it if it times out
368
-				if ($this->_writeableServices[$this->_currentWriteService]->ping($this->_writePingTimeout) === false)
369
-				{
311
+				if ($this->_writeableServices[$this->_currentWriteService]->ping($this->_writePingTimeout) === false) {
370 312
 					$this->removeWriteService($this->_currentWriteService);
371 313
 				}
372 314
 			}
373 315
 
374
-			if (count($this->_writeableServices))
375
-			{
316
+			if (count($this->_writeableServices)) {
376 317
 				// select one of the read services at random
377 318
 				$ids = array_keys($this->_writeableServices);
378 319
 
379 320
 				$id = $ids[rand(0, count($ids) - 1)];
380 321
 				$service = $this->_writeableServices[$id];
381 322
 
382
-				if (is_array($service))
383
-				{
323
+				if (is_array($service)) {
384 324
 					//convert the array definition to a client object
385 325
 					$service = new Apache_Solr_Service($service['host'], $service['port'], $service['path']);
386 326
 					$this->_writeableServices[$id] = $service;
387 327
 				}
388 328
 
389 329
 				$this->_currentWriteService = $id;
390
-			}
391
-			else
392
-			{
330
+			} else {
393 331
 				throw new Apache_Solr_NoServiceAvailableException('No write services were available');
394 332
 			}
395 333
 		}
@@ -409,12 +347,9 @@  discard block
 block discarded – undo
409 347
 	 * @throws Apache_Solr_NoServiceAvailableException If there are no write services that meet requirements
410 348
 	 */
411 349
 
412
-	protected function _selectWriteServiceSafe($forceSelect = false)
413
-	{
414
-		if (!$this->_currentWriteService || !isset($this->_writeableServices[$this->_currentWriteService]) || $forceSelect)
415
-		{
416
-			if (count($this->_writeableServices))
417
-			{
350
+	protected function _selectWriteServiceSafe($forceSelect = false) {
351
+		if (!$this->_currentWriteService || !isset($this->_writeableServices[$this->_currentWriteService]) || $forceSelect) {
352
+			if (count($this->_writeableServices)) {
418 353
 				$backoff = $this->_defaultBackoff;
419 354
 
420 355
 				do {
@@ -424,8 +359,7 @@  discard block
 block discarded – undo
424 359
 					$id = $ids[rand(0, count($ids) - 1)];
425 360
 					$service = $this->_writeableServices[$id];
426 361
 
427
-					if (is_array($service))
428
-					{
362
+					if (is_array($service)) {
429 363
 						//convert the array definition to a client object
430 364
 						$service = new Apache_Solr_Service($service['host'], $service['port'], $service['path']);
431 365
 						$this->_writeableServices[$id] = $service;
@@ -435,15 +369,12 @@  discard block
 block discarded – undo
435 369
 
436 370
 					$backoff *= $this->_backoffEscalation;
437 371
 
438
-					if($backoff > $this->_backoffLimit)
439
-					{
372
+					if($backoff > $this->_backoffLimit) {
440 373
 						throw new Apache_Solr_NoServiceAvailableException('No write services were available.  All timeouts exceeded.');
441 374
 					}
442 375
 
443 376
 				} while($this->_writeableServices[$this->_currentWriteService]->ping($backoff) === false);
444
-			}
445
-			else
446
-			{
377
+			} else {
447 378
 				throw new Apache_Solr_NoServiceAvailableException('No write services were available');
448 379
 			}
449 380
 		}
@@ -457,13 +388,11 @@  discard block
 block discarded – undo
457 388
 	 *
458 389
 	 * @param boolean $createDocuments
459 390
 	 */
460
-	public function setCreateDocuments($createDocuments)
461
-	{
391
+	public function setCreateDocuments($createDocuments) {
462 392
 		$this->_createDocuments = (bool) $createDocuments;
463 393
 
464 394
 		// set on current read service
465
-		if ($this->_currentReadService)
466
-		{
395
+		if ($this->_currentReadService) {
467 396
 			$service = $this->_selectReadService();
468 397
 			$service->setCreateDocuments($createDocuments);
469 398
 		}
@@ -474,8 +403,7 @@  discard block
 block discarded – undo
474 403
 	 *
475 404
 	 * @return boolean
476 405
 	 */
477
-	public function getCreateDocuments()
478
-	{
406
+	public function getCreateDocuments() {
479 407
 		return $this->_createDocuments;
480 408
 	}
481 409
 	
@@ -488,22 +416,19 @@  discard block
 block discarded – undo
488 416
 	 *
489 417
 	 * @throws Apache_Solr_HttpTransportException If an error occurs during the service call
490 418
 	 */
491
-	public function add($rawPost)
492
-	{
419
+	public function add($rawPost) {
493 420
 		$service = $this->_selectWriteService();
494 421
 
495
-		do
496
-		{
497
-			try
498
-			{
422
+		do {
423
+			try {
499 424
 				return $service->add($rawPost);
500
-			}
501
-			catch (Apache_Solr_HttpTransportException $e)
502
-			{
503
-				if ($e->getCode() != 0) //IF NOT COMMUNICATION ERROR
425
+			} catch (Apache_Solr_HttpTransportException $e) {
426
+				if ($e->getCode() != 0) {
427
+				    //IF NOT COMMUNICATION ERROR
504 428
 				{
505 429
 					throw $e;
506 430
 				}
431
+				}
507 432
 			}
508 433
 
509 434
 			$service = $this->_selectWriteService(true);
@@ -523,22 +448,19 @@  discard block
 block discarded – undo
523 448
 	 *
524 449
 	 * @throws Apache_Solr_HttpTransportException If an error occurs during the service call
525 450
 	 */
526
-	public function addDocument(Apache_Solr_Document $document, $allowDups = false, $overwritePending = true, $overwriteCommitted = true)
527
-	{
451
+	public function addDocument(Apache_Solr_Document $document, $allowDups = false, $overwritePending = true, $overwriteCommitted = true) {
528 452
 		$service = $this->_selectWriteService();
529 453
 
530
-		do
531
-		{
532
-			try
533
-			{
454
+		do {
455
+			try {
534 456
 				return $service->addDocument($document, $allowDups, $overwritePending, $overwriteCommitted);
535
-			}
536
-			catch (Apache_Solr_HttpTransportException $e)
537
-			{
538
-				if ($e->getCode() != 0) //IF NOT COMMUNICATION ERROR
457
+			} catch (Apache_Solr_HttpTransportException $e) {
458
+				if ($e->getCode() != 0) {
459
+				    //IF NOT COMMUNICATION ERROR
539 460
 				{
540 461
 					throw $e;
541 462
 				}
463
+				}
542 464
 			}
543 465
 
544 466
 			$service = $this->_selectWriteService(true);
@@ -558,22 +480,19 @@  discard block
 block discarded – undo
558 480
 	 *
559 481
 	 * @throws Apache_Solr_HttpTransportException If an error occurs during the service call
560 482
 	 */
561
-	public function addDocuments($documents, $allowDups = false, $overwritePending = true, $overwriteCommitted = true)
562
-	{
483
+	public function addDocuments($documents, $allowDups = false, $overwritePending = true, $overwriteCommitted = true) {
563 484
 		$service = $this->_selectWriteService();
564 485
 
565
-		do
566
-		{
567
-			try
568
-			{
486
+		do {
487
+			try {
569 488
 				return $service->addDocuments($documents, $allowDups, $overwritePending, $overwriteCommitted);
570
-			}
571
-			catch (Apache_Solr_HttpTransportException $e)
572
-			{
573
-				if ($e->getCode() != 0) //IF NOT COMMUNICATION ERROR
489
+			} catch (Apache_Solr_HttpTransportException $e) {
490
+				if ($e->getCode() != 0) {
491
+				    //IF NOT COMMUNICATION ERROR
574 492
 				{
575 493
 					throw $e;
576 494
 				}
495
+				}
577 496
 			}
578 497
 
579 498
 			$service = $this->_selectWriteService(true);
@@ -592,22 +511,19 @@  discard block
 block discarded – undo
592 511
 	 *
593 512
 	 * @throws Apache_Solr_HttpTransportException If an error occurs during the service call
594 513
 	 */
595
-	public function commit($optimize = true, $waitFlush = true, $waitSearcher = true, $timeout = 3600)
596
-	{
514
+	public function commit($optimize = true, $waitFlush = true, $waitSearcher = true, $timeout = 3600) {
597 515
 		$service = $this->_selectWriteService();
598 516
 
599
-		do
600
-		{
601
-			try
602
-			{
517
+		do {
518
+			try {
603 519
 				return $service->commit($optimize, $waitFlush, $waitSearcher, $timeout);
604
-			}
605
-			catch (Apache_Solr_HttpTransportException $e)
606
-			{
607
-				if ($e->getCode() != 0) //IF NOT COMMUNICATION ERROR
520
+			} catch (Apache_Solr_HttpTransportException $e) {
521
+				if ($e->getCode() != 0) {
522
+				    //IF NOT COMMUNICATION ERROR
608 523
 				{
609 524
 					throw $e;
610 525
 				}
526
+				}
611 527
 			}
612 528
 
613 529
 			$service = $this->_selectWriteService(true);
@@ -626,22 +542,19 @@  discard block
 block discarded – undo
626 542
 	 *
627 543
 	 * @throws Apache_Solr_HttpTransportException If an error occurs during the service call
628 544
 	 */
629
-	public function delete($rawPost, $timeout = 3600)
630
-	{
545
+	public function delete($rawPost, $timeout = 3600) {
631 546
 		$service = $this->_selectWriteService();
632 547
 
633
-		do
634
-		{
635
-			try
636
-			{
548
+		do {
549
+			try {
637 550
 				return $service->delete($rawPost, $timeout);
638
-			}
639
-			catch (Apache_Solr_HttpTransportException $e)
640
-			{
641
-				if ($e->getCode() != 0) //IF NOT COMMUNICATION ERROR
551
+			} catch (Apache_Solr_HttpTransportException $e) {
552
+				if ($e->getCode() != 0) {
553
+				    //IF NOT COMMUNICATION ERROR
642 554
 				{
643 555
 					throw $e;
644 556
 				}
557
+				}
645 558
 			}
646 559
 
647 560
 			$service = $this->_selectWriteService(true);
@@ -661,22 +574,19 @@  discard block
 block discarded – undo
661 574
 	 *
662 575
 	 * @throws Apache_Solr_HttpTransportException If an error occurs during the service call
663 576
 	 */
664
-	public function deleteById($id, $fromPending = true, $fromCommitted = true, $timeout = 3600)
665
-	{
577
+	public function deleteById($id, $fromPending = true, $fromCommitted = true, $timeout = 3600) {
666 578
 		$service = $this->_selectWriteService();
667 579
 
668
-		do
669
-		{
670
-			try
671
-			{
580
+		do {
581
+			try {
672 582
 				return $service->deleteById($id, $fromPending, $fromCommitted, $timeout);
673
-			}
674
-			catch (Apache_Solr_HttpTransportException $e)
675
-			{
676
-				if ($e->getCode() != 0) //IF NOT COMMUNICATION ERROR
583
+			} catch (Apache_Solr_HttpTransportException $e) {
584
+				if ($e->getCode() != 0) {
585
+				    //IF NOT COMMUNICATION ERROR
677 586
 				{
678 587
 					throw $e;
679 588
 				}
589
+				}
680 590
 			}
681 591
 
682 592
 			$service = $this->_selectWriteService(true);
@@ -696,22 +606,19 @@  discard block
 block discarded – undo
696 606
 	 *
697 607
 	 * @throws Apache_Solr_HttpTransportException If an error occurs during the service call
698 608
 	 */
699
-	public function deleteByMultipleIds($ids, $fromPending = true, $fromCommitted = true, $timeout = 3600)
700
-	{
609
+	public function deleteByMultipleIds($ids, $fromPending = true, $fromCommitted = true, $timeout = 3600) {
701 610
 		$service = $this->_selectWriteService();
702 611
 
703
-		do
704
-		{
705
-			try
706
-			{
612
+		do {
613
+			try {
707 614
 				return $service->deleteByMultipleId($ids, $fromPending, $fromCommitted, $timeout);
708
-			}
709
-			catch (Apache_Solr_HttpTransportException $e)
710
-			{
711
-				if ($e->getCode() != 0) //IF NOT COMMUNICATION ERROR
615
+			} catch (Apache_Solr_HttpTransportException $e) {
616
+				if ($e->getCode() != 0) {
617
+				    //IF NOT COMMUNICATION ERROR
712 618
 				{
713 619
 					throw $e;
714 620
 				}
621
+				}
715 622
 			}
716 623
 
717 624
 			$service = $this->_selectWriteService(true);
@@ -731,22 +638,19 @@  discard block
 block discarded – undo
731 638
 	 *
732 639
 	 * @throws Apache_Solr_HttpTransportException If an error occurs during the service call
733 640
 	 */
734
-	public function deleteByQuery($rawQuery, $fromPending = true, $fromCommitted = true, $timeout = 3600)
735
-	{
641
+	public function deleteByQuery($rawQuery, $fromPending = true, $fromCommitted = true, $timeout = 3600) {
736 642
 		$service = $this->_selectWriteService();
737 643
 
738
-		do
739
-		{
740
-			try
741
-			{
644
+		do {
645
+			try {
742 646
 				return $service->deleteByQuery($rawQuery, $fromPending, $fromCommitted, $timeout);
743
-			}
744
-			catch (Apache_Solr_HttpTransportException $e)
745
-			{
746
-				if ($e->getCode() != 0) //IF NOT COMMUNICATION ERROR
647
+			} catch (Apache_Solr_HttpTransportException $e) {
648
+				if ($e->getCode() != 0) {
649
+				    //IF NOT COMMUNICATION ERROR
747 650
 				{
748 651
 					throw $e;
749 652
 				}
653
+				}
750 654
 			}
751 655
 
752 656
 			$service = $this->_selectWriteService(true);
@@ -773,22 +677,19 @@  discard block
 block discarded – undo
773 677
 	 *
774 678
 	 * @throws Apache_Solr_InvalidArgumentException if $file, $params, or $document are invalid.
775 679
 	 */
776
-	public function extract($file, $params = array(), $document = null, $mimetype = 'application/octet-stream')
777
-	{
680
+	public function extract($file, $params = array(), $document = null, $mimetype = 'application/octet-stream') {
778 681
 		$service = $this->_selectWriteService();
779 682
 
780
-		do
781
-		{
782
-			try
783
-			{
683
+		do {
684
+			try {
784 685
 				return $service->extract($file, $params, $document, $mimetype);
785
-			}
786
-			catch (Apache_Solr_HttpTransportException $e)
787
-			{
788
-				if ($e->getCode() != 0) //IF NOT COMMUNICATION ERROR
686
+			} catch (Apache_Solr_HttpTransportException $e) {
687
+				if ($e->getCode() != 0) {
688
+				    //IF NOT COMMUNICATION ERROR
789 689
 				{
790 690
 					throw $e;
791 691
 				}
692
+				}
792 693
 			}
793 694
 
794 695
 			$service = $this->_selectWriteService(true);
@@ -817,22 +718,19 @@  discard block
 block discarded – undo
817 718
 	 *
818 719
 	 * @todo Should be using multipart/form-data to post parameter values, but I could not get my implementation to work. Needs revisisted.
819 720
 	 */
820
-	public function extractFromString($data, $params = array(), $document = null, $mimetype = 'application/octet-stream')
821
-	{
721
+	public function extractFromString($data, $params = array(), $document = null, $mimetype = 'application/octet-stream') {
822 722
 		$service = $this->_selectWriteService();
823 723
 
824
-		do
825
-		{
826
-			try
827
-			{
724
+		do {
725
+			try {
828 726
 				return $service->extractFromString($data, $params, $document, $mimetype);
829
-			}
830
-			catch (Apache_Solr_HttpTransportException $e)
831
-			{
832
-				if ($e->getCode() != 0) //IF NOT COMMUNICATION ERROR
727
+			} catch (Apache_Solr_HttpTransportException $e) {
728
+				if ($e->getCode() != 0) {
729
+				    //IF NOT COMMUNICATION ERROR
833 730
 				{
834 731
 					throw $e;
835 732
 				}
733
+				}
836 734
 			}
837 735
 
838 736
 			$service = $this->_selectWriteService(true);
@@ -852,22 +750,19 @@  discard block
 block discarded – undo
852 750
 	 *
853 751
 	 * @throws Apache_Solr_HttpTransportException If an error occurs during the service call
854 752
 	 */
855
-	public function optimize($waitFlush = true, $waitSearcher = true, $timeout = 3600)
856
-	{
753
+	public function optimize($waitFlush = true, $waitSearcher = true, $timeout = 3600) {
857 754
 		$service = $this->_selectWriteService();
858 755
 
859
-		do
860
-		{
861
-			try
862
-			{
756
+		do {
757
+			try {
863 758
 				return $service->optimize($waitFlush, $waitSearcher, $timeout);
864
-			}
865
-			catch (Apache_Solr_HttpTransportException $e)
866
-			{
867
-				if ($e->getCode() != 0) //IF NOT COMMUNICATION ERROR
759
+			} catch (Apache_Solr_HttpTransportException $e) {
760
+				if ($e->getCode() != 0) {
761
+				    //IF NOT COMMUNICATION ERROR
868 762
 				{
869 763
 					throw $e;
870 764
 				}
765
+				}
871 766
 			}
872 767
 
873 768
 			$service = $this->_selectWriteService(true);
@@ -888,22 +783,19 @@  discard block
 block discarded – undo
888 783
 	 *
889 784
 	 * @throws Apache_Solr_HttpTransportException If an error occurs during the service call
890 785
 	 */
891
-	public function search($query, $offset = 0, $limit = 10, $params = array(), $method = Apache_Solr_Service::METHOD_GET)
892
-	{
786
+	public function search($query, $offset = 0, $limit = 10, $params = array(), $method = Apache_Solr_Service::METHOD_GET) {
893 787
 		$service = $this->_selectReadService();
894 788
 
895
-		do
896
-		{
897
-			try
898
-			{
789
+		do {
790
+			try {
899 791
 				return $service->search($query, $offset, $limit, $params, $method);
900
-			}
901
-			catch (Apache_Solr_HttpTransportException $e)
902
-			{
903
-				if ($e->getCode() != 0) //IF NOT COMMUNICATION ERROR
792
+			} catch (Apache_Solr_HttpTransportException $e) {
793
+				if ($e->getCode() != 0) {
794
+				    //IF NOT COMMUNICATION ERROR
904 795
 				{
905 796
 					throw $e;
906 797
 				}
798
+				}
907 799
 			}
908 800
 
909 801
 			$service = $this->_selectReadService(true);
Please login to merge, or discard this patch.
dlf/lib/SolrPhpClient/Apache/Solr/Response.php 1 patch
Braces   +20 added lines, -41 removed lines patch added patch discarded remove patch
@@ -45,8 +45,7 @@  discard block
 block discarded – undo
45 45
  * Currently requires json_decode which is bundled with PHP >= 5.2.0, Alternatively can be
46 46
  * installed with PECL.  Zend Framework also includes a purely PHP solution.
47 47
  */
48
-class Apache_Solr_Response
49
-{
48
+class Apache_Solr_Response {
50 49
 	/**
51 50
 	 * SVN Revision meta data for this class
52 51
 	 */
@@ -94,8 +93,7 @@  discard block
 block discarded – undo
94 93
 	 * @param boolean $createDocuments Whether to convert the documents json_decoded as stdClass instances to Apache_Solr_Document instances
95 94
 	 * @param boolean $collapseSingleValueArrays Whether to make multivalued fields appear as single values
96 95
 	 */
97
-	public function __construct(Apache_Solr_HttpTransport_Response $response, $createDocuments = true, $collapseSingleValueArrays = true)
98
-	{
96
+	public function __construct(Apache_Solr_HttpTransport_Response $response, $createDocuments = true, $collapseSingleValueArrays = true) {
99 97
 		$this->_response = $response;
100 98
 		$this->_createDocuments = (bool) $createDocuments;
101 99
 		$this->_collapseSingleValueArrays = (bool) $collapseSingleValueArrays;
@@ -106,8 +104,7 @@  discard block
 block discarded – undo
106 104
 	 *
107 105
 	 * @return integer
108 106
 	 */
109
-	public function getHttpStatus()
110
-	{
107
+	public function getHttpStatus() {
111 108
 		return $this->_response->getStatusCode();
112 109
 	}
113 110
 
@@ -116,8 +113,7 @@  discard block
 block discarded – undo
116 113
 	 *
117 114
 	 * @return string
118 115
 	 */
119
-	public function getHttpStatusMessage()
120
-	{
116
+	public function getHttpStatusMessage() {
121 117
 		return $this->_response->getStatusMessage();
122 118
 	}
123 119
 
@@ -126,8 +122,7 @@  discard block
 block discarded – undo
126 122
 	 *
127 123
 	 * @return string
128 124
 	 */
129
-	public function getType()
130
-	{
125
+	public function getType() {
131 126
 		return $this->_response->getMimeType();
132 127
 	}
133 128
 
@@ -136,8 +131,7 @@  discard block
 block discarded – undo
136 131
 	 *
137 132
 	 * @return string
138 133
 	 */
139
-	public function getEncoding()
140
-	{
134
+	public function getEncoding() {
141 135
 		return $this->_response->getEncoding();
142 136
 	}
143 137
 
@@ -146,8 +140,7 @@  discard block
 block discarded – undo
146 140
 	 *
147 141
 	 * @return string
148 142
 	 */
149
-	public function getRawResponse()
150
-	{
143
+	public function getRawResponse() {
151 144
 		return $this->_response->getBody();
152 145
 	}
153 146
 
@@ -157,16 +150,13 @@  discard block
 block discarded – undo
157 150
 	 * @param string $key
158 151
 	 * @return mixed
159 152
 	 */
160
-	public function __get($key)
161
-	{
162
-		if (!$this->_isParsed)
163
-		{
153
+	public function __get($key) {
154
+		if (!$this->_isParsed) {
164 155
 			$this->_parseData();
165 156
 			$this->_isParsed = true;
166 157
 		}
167 158
 
168
-		if (isset($this->_parsedData->$key))
169
-		{
159
+		if (isset($this->_parsedData->$key)) {
170 160
 			return $this->_parsedData->$key;
171 161
 		}
172 162
 
@@ -179,10 +169,8 @@  discard block
 block discarded – undo
179 169
 	 * @param string $key
180 170
 	 * @return boolean
181 171
 	 */
182
-	public function __isset($key)
183
-	{
184
-		if (!$this->_isParsed)
185
-		{
172
+	public function __isset($key) {
173
+		if (!$this->_isParsed) {
186 174
 			$this->_parseData();
187 175
 			$this->_isParsed = true;
188 176
 		}
@@ -195,41 +183,32 @@  discard block
 block discarded – undo
195 183
 	 *
196 184
 	 * @throws Apache_Solr_ParserException If the data could not be parsed
197 185
 	 */
198
-	protected function _parseData()
199
-	{
186
+	protected function _parseData() {
200 187
 		//An alternative would be to use Zend_Json::decode(...)
201 188
 		$data = json_decode($this->_response->getBody());
202 189
 
203 190
 		// check that we receive a valid JSON response - we should never receive a null
204
-		if ($data === null)
205
-		{
191
+		if ($data === null) {
206 192
 			throw new Apache_Solr_ParserException('Solr response does not appear to be valid JSON, please examine the raw response with getRawResponse() method');
207 193
 		}
208 194
 
209 195
 		//if we're configured to collapse single valued arrays or to convert them to Apache_Solr_Document objects
210 196
 		//and we have response documents, then try to collapse the values and / or convert them now
211
-		if (($this->_createDocuments || $this->_collapseSingleValueArrays) && isset($data->response) && is_array($data->response->docs))
212
-		{
197
+		if (($this->_createDocuments || $this->_collapseSingleValueArrays) && isset($data->response) && is_array($data->response->docs)) {
213 198
 			$documents = array();
214 199
 
215
-			foreach ($data->response->docs as $originalDocument)
216
-			{
217
-				if ($this->_createDocuments)
218
-				{
200
+			foreach ($data->response->docs as $originalDocument) {
201
+				if ($this->_createDocuments) {
219 202
 					$document = new Apache_Solr_Document();
220
-				}
221
-				else
222
-				{
203
+				} else {
223 204
 					$document = $originalDocument;
224 205
 				}
225 206
 
226
-				foreach ($originalDocument as $key => $value)
227
-				{
207
+				foreach ($originalDocument as $key => $value) {
228 208
 					//If a result is an array with only a single
229 209
 					//value then its nice to be able to access
230 210
 					//it as if it were always a single value
231
-					if ($this->_collapseSingleValueArrays && is_array($value) && count($value) <= 1)
232
-					{
211
+					if ($this->_collapseSingleValueArrays && is_array($value) && count($value) <= 1) {
233 212
 						$value = array_shift($value);
234 213
 					}
235 214
 
Please login to merge, or discard this patch.
dlf/lib/SolrPhpClient/Apache/Solr/ParserException.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,8 +36,7 @@
 block discarded – undo
36 36
  * @author Donovan Jimenez <[email protected]>
37 37
  */
38 38
 
39
-class Apache_Solr_ParserException extends Apache_Solr_Exception
40
-{
39
+class Apache_Solr_ParserException extends Apache_Solr_Exception {
41 40
 	/**
42 41
 	 * SVN Revision meta data for this class
43 42
 	 */
Please login to merge, or discard this patch.
dlf/lib/SolrPhpClient/Apache/Solr/Service.php 1 patch
Braces   +99 added lines, -212 removed lines patch added patch discarded remove patch
@@ -83,8 +83,7 @@  discard block
 block discarded – undo
83 83
  * @todo Investigate using other HTTP clients other than file_get_contents built-in handler. Could provide performance
84 84
  * improvements when dealing with multiple requests by using HTTP's keep alive functionality
85 85
  */
86
-class Apache_Solr_Service
87
-{
86
+class Apache_Solr_Service {
88 87
 	/**
89 88
 	 * SVN Revision meta data for this class
90 89
 	 */
@@ -189,8 +188,7 @@  discard block
 block discarded – undo
189 188
 	 * @param string $value
190 189
 	 * @return string
191 190
 	 */
192
-	static public function escape($value)
193
-	{
191
+	static public function escape($value) {
194 192
 		//list taken from http://lucene.apache.org/java/docs/queryparsersyntax.html#Escaping%20Special%20Characters
195 193
 		$pattern = '/(\+|-|&&|\|\||!|\(|\)|\{|}|\[|]|\^|"|~|\*|\?|:|\\\)/';
196 194
 		$replace = '\\\$1';
@@ -204,8 +202,7 @@  discard block
 block discarded – undo
204 202
 	 * @param string $value
205 203
 	 * @return string
206 204
 	 */
207
-	static public function escapePhrase($value)
208
-	{
205
+	static public function escapePhrase($value) {
209 206
 		$pattern = '/("|\\\)/';
210 207
 		$replace = '\\\$1';
211 208
 
@@ -218,8 +215,7 @@  discard block
 block discarded – undo
218 215
 	 * @param string $value
219 216
 	 * @return string
220 217
 	 */
221
-	static public function phrase($value)
222
-	{
218
+	static public function phrase($value) {
223 219
 		return '"' . self::escapePhrase($value) . '"';
224 220
 	}
225 221
 
@@ -232,16 +228,14 @@  discard block
 block discarded – undo
232 228
 	 * @param string $path
233 229
 	 * @param Apache_Solr_HttpTransport_Interface $httpTransport
234 230
 	 */
235
-	public function __construct($host = 'localhost', $port = 8180, $path = '/solr/', $httpTransport = false)
236
-	{
231
+	public function __construct($host = 'localhost', $port = 8180, $path = '/solr/', $httpTransport = false) {
237 232
 		$this->setHost($host);
238 233
 		$this->setPort($port);
239 234
 		$this->setPath($path);
240 235
 
241 236
 		$this->_initUrls();
242 237
 
243
-		if ($httpTransport)
244
-		{
238
+		if ($httpTransport) {
245 239
 			$this->setHttpTransport($httpTransport);
246 240
 		}
247 241
 
@@ -255,22 +249,17 @@  discard block
 block discarded – undo
255 249
 	 * @param string $servlet
256 250
 	 * @return string
257 251
 	 */
258
-	protected function _constructUrl($servlet, $params = array())
259
-	{
260
-		if (count($params))
261
-		{
252
+	protected function _constructUrl($servlet, $params = array()) {
253
+		if (count($params)) {
262 254
 			//escape all parameters appropriately for inclusion in the query string
263 255
 			$escapedParams = array();
264 256
 
265
-			foreach ($params as $key => $value)
266
-			{
257
+			foreach ($params as $key => $value) {
267 258
 				$escapedParams[] = urlencode($key) . '=' . urlencode($value);
268 259
 			}
269 260
 
270 261
 			$queryString = $this->_queryDelimiter . implode($this->_queryStringDelimiter, $escapedParams);
271
-		}
272
-		else
273
-		{
262
+		} else {
274 263
 			$queryString = '';
275 264
 		}
276 265
 
@@ -280,8 +269,7 @@  discard block
 block discarded – undo
280 269
 	/**
281 270
 	 * Construct the Full URLs for the three servlets we reference
282 271
 	 */
283
-	protected function _initUrls()
284
-	{
272
+	protected function _initUrls() {
285 273
 		//Initialize our full servlet URLs now that we have server information
286 274
 		$this->_extractUrl = $this->_constructUrl(self::EXTRACT_SERVLET);
287 275
 		$this->_pingUrl = $this->_constructUrl(self::PING_SERVLET);
@@ -292,8 +280,7 @@  discard block
 block discarded – undo
292 280
 		$this->_urlsInited = true;
293 281
 	}
294 282
 
295
-	protected function _generateQueryString($params)
296
-	{
283
+	protected function _generateQueryString($params) {
297 284
 		// use http_build_query to encode our arguments because its faster
298 285
 		// than urlencoding all the parts ourselves in a loop
299 286
 		//
@@ -305,13 +292,10 @@  discard block
 block discarded – undo
305 292
 		// NOTE: before php 5.1.3 brackets were not url encoded by http_build query - we've checked
306 293
 		// the php version in the constructor and put the results in the instance variable. Also, before
307 294
 		// 5.1.2 the arg_separator parameter was not available, so don't use it
308
-		if ($this->_queryBracketsEscaped)
309
-		{
295
+		if ($this->_queryBracketsEscaped) {
310 296
 			$queryString = http_build_query($params, null, $this->_queryStringDelimiter);
311 297
 			return preg_replace('/%5B(?:[0-9]|[1-9][0-9]+)%5D=/', '=', $queryString);
312
-		}
313
-		else
314
-		{
298
+		} else {
315 299
 			$queryString = http_build_query($params);
316 300
 			return preg_replace('/\\[(?:[0-9]|[1-9][0-9]+)\\]=/', '=', $queryString);
317 301
 		}
@@ -326,15 +310,13 @@  discard block
 block discarded – undo
326 310
 	 *
327 311
 	 * @throws Apache_Solr_HttpTransportException If a non 200 response status is returned
328 312
 	 */
329
-	protected function _sendRawGet($url, $timeout = FALSE)
330
-	{
313
+	protected function _sendRawGet($url, $timeout = FALSE) {
331 314
 		$httpTransport = $this->getHttpTransport();
332 315
 
333 316
 		$httpResponse = $httpTransport->performGetRequest($url, $timeout);
334 317
 		$solrResponse = new Apache_Solr_Response($httpResponse, $this->_createDocuments, $this->_collapseSingleValueArrays);
335 318
 
336
-		if ($solrResponse->getHttpStatus() != 200)
337
-		{
319
+		if ($solrResponse->getHttpStatus() != 200) {
338 320
 			throw new Apache_Solr_HttpTransportException($solrResponse);
339 321
 		}
340 322
 
@@ -352,15 +334,13 @@  discard block
 block discarded – undo
352 334
 	 *
353 335
 	 * @throws Apache_Solr_HttpTransportException If a non 200 response status is returned
354 336
 	 */
355
-	protected function _sendRawPost($url, $rawPost, $timeout = FALSE, $contentType = 'text/xml; charset=UTF-8')
356
-	{
337
+	protected function _sendRawPost($url, $rawPost, $timeout = FALSE, $contentType = 'text/xml; charset=UTF-8') {
357 338
 		$httpTransport = $this->getHttpTransport();
358 339
 
359 340
 		$httpResponse = $httpTransport->performPostRequest($url, $rawPost, $contentType, $timeout);
360 341
 		$solrResponse = new Apache_Solr_Response($httpResponse, $this->_createDocuments, $this->_collapseSingleValueArrays);
361 342
 
362
-		if ($solrResponse->getHttpStatus() != 200)
363
-		{
343
+		if ($solrResponse->getHttpStatus() != 200) {
364 344
 			throw new Apache_Solr_HttpTransportException($solrResponse);
365 345
 		}
366 346
 
@@ -372,8 +352,7 @@  discard block
 block discarded – undo
372 352
 	 *
373 353
 	 * @return string
374 354
 	 */
375
-	public function getHost()
376
-	{
355
+	public function getHost() {
377 356
 		return $this->_host;
378 357
 	}
379 358
 
@@ -384,20 +363,15 @@  discard block
 block discarded – undo
384 363
 	 *
385 364
 	 * @throws Apache_Solr_InvalidArgumentException If the host parameter is empty
386 365
 	 */
387
-	public function setHost($host)
388
-	{
366
+	public function setHost($host) {
389 367
 		//Use the provided host or use the default
390
-		if (empty($host))
391
-		{
368
+		if (empty($host)) {
392 369
 			throw new Apache_Solr_InvalidArgumentException('Host parameter is empty');
393
-		}
394
-		else
395
-		{
370
+		} else {
396 371
 			$this->_host = $host;
397 372
 		}
398 373
 
399
-		if ($this->_urlsInited)
400
-		{
374
+		if ($this->_urlsInited) {
401 375
 			$this->_initUrls();
402 376
 		}
403 377
 	}
@@ -407,8 +381,7 @@  discard block
 block discarded – undo
407 381
 	 *
408 382
 	 * @return integer
409 383
 	 */
410
-	public function getPort()
411
-	{
384
+	public function getPort() {
412 385
 		return $this->_port;
413 386
 	}
414 387
 
@@ -419,22 +392,17 @@  discard block
 block discarded – undo
419 392
 	 *
420 393
 	 * @throws Apache_Solr_InvalidArgumentException If the port parameter is empty
421 394
 	 */
422
-	public function setPort($port)
423
-	{
395
+	public function setPort($port) {
424 396
 		//Use the provided port or use the default
425 397
 		$port = (int) $port;
426 398
 
427
-		if ($port <= 0)
428
-		{
399
+		if ($port <= 0) {
429 400
 			throw new Apache_Solr_InvalidArgumentException('Port is not a valid port number');
430
-		}
431
-		else
432
-		{
401
+		} else {
433 402
 			$this->_port = $port;
434 403
 		}
435 404
 
436
-		if ($this->_urlsInited)
437
-		{
405
+		if ($this->_urlsInited) {
438 406
 			$this->_initUrls();
439 407
 		}
440 408
 	}
@@ -444,8 +412,7 @@  discard block
 block discarded – undo
444 412
 	 *
445 413
 	 * @return string
446 414
 	 */
447
-	public function getPath()
448
-	{
415
+	public function getPath() {
449 416
 		return $this->_path;
450 417
 	}
451 418
 
@@ -454,14 +421,12 @@  discard block
 block discarded – undo
454 421
 	 *
455 422
 	 * @param string $path
456 423
 	 */
457
-	public function setPath($path)
458
-	{
424
+	public function setPath($path) {
459 425
 		$path = trim($path, '/');
460 426
 
461 427
 		$this->_path = '/' . $path . '/';
462 428
 
463
-		if ($this->_urlsInited)
464
-		{
429
+		if ($this->_urlsInited) {
465 430
 			$this->_initUrls();
466 431
 		}
467 432
 	}
@@ -471,11 +436,9 @@  discard block
 block discarded – undo
471 436
 	 *
472 437
 	 * @return HttpTransportInterface
473 438
 	 */
474
-	public function getHttpTransport()
475
-	{
439
+	public function getHttpTransport() {
476 440
 		// lazy load a default if one has not be set
477
-		if ($this->_httpTransport === false)
478
-		{
441
+		if ($this->_httpTransport === false) {
479 442
 			require_once(dirname(__FILE__) . '/HttpTransport/FileGetContents.php');
480 443
 
481 444
 			$this->_httpTransport = new Apache_Solr_HttpTransport_FileGetContents();
@@ -489,8 +452,7 @@  discard block
 block discarded – undo
489 452
 	 *
490 453
 	 * @param Apache_Solr_HttpTransport_Interface
491 454
 	 */
492
-	public function setHttpTransport(Apache_Solr_HttpTransport_Interface $httpTransport)
493
-	{
455
+	public function setHttpTransport(Apache_Solr_HttpTransport_Interface $httpTransport) {
494 456
 		$this->_httpTransport = $httpTransport;
495 457
 	}
496 458
 
@@ -500,8 +462,7 @@  discard block
 block discarded – undo
500 462
 	 *
501 463
 	 * @param boolean $createDocuments
502 464
 	 */
503
-	public function setCreateDocuments($createDocuments)
504
-	{
465
+	public function setCreateDocuments($createDocuments) {
505 466
 		$this->_createDocuments = (bool) $createDocuments;
506 467
 	}
507 468
 
@@ -510,8 +471,7 @@  discard block
 block discarded – undo
510 471
 	 *
511 472
 	 * @return boolean
512 473
 	 */
513
-	public function getCreateDocuments()
514
-	{
474
+	public function getCreateDocuments() {
515 475
 		return $this->_createDocuments;
516 476
 	}
517 477
 
@@ -520,8 +480,7 @@  discard block
 block discarded – undo
520 480
 	 *
521 481
 	 * @param boolean $collapseSingleValueArrays
522 482
 	 */
523
-	public function setCollapseSingleValueArrays($collapseSingleValueArrays)
524
-	{
483
+	public function setCollapseSingleValueArrays($collapseSingleValueArrays) {
525 484
 		$this->_collapseSingleValueArrays = (bool) $collapseSingleValueArrays;
526 485
 	}
527 486
 
@@ -530,8 +489,7 @@  discard block
 block discarded – undo
530 489
 	 *
531 490
 	 * @return boolean
532 491
 	 */
533
-	public function getCollapseSingleValueArrays()
534
-	{
492
+	public function getCollapseSingleValueArrays() {
535 493
 		return $this->_collapseSingleValueArrays;
536 494
 	}
537 495
 
@@ -543,8 +501,7 @@  discard block
 block discarded – undo
543 501
 	 *
544 502
 	 * @deprecated Use the getDefaultTimeout method on the HTTP transport implementation
545 503
 	 */
546
-	public function getDefaultTimeout()
547
-	{
504
+	public function getDefaultTimeout() {
548 505
 		return $this->getHttpTransport()->getDefaultTimeout();
549 506
 	}
550 507
 
@@ -555,8 +512,7 @@  discard block
 block discarded – undo
555 512
 	 *
556 513
 	 * @deprecated Use the setDefaultTimeout method on the HTTP transport implementation
557 514
 	 */
558
-	public function setDefaultTimeout($timeout)
559
-	{
515
+	public function setDefaultTimeout($timeout) {
560 516
 		$this->getHttpTransport()->setDefaultTimeout($timeout);
561 517
 	}
562 518
 
@@ -567,10 +523,8 @@  discard block
 block discarded – undo
567 523
 	 * @param string $namedListTreatment
568 524
 	 * @throws Apache_Solr_InvalidArgumentException If invalid option is set
569 525
 	 */
570
-	public function setNamedListTreatment($namedListTreatment)
571
-	{
572
-		switch ((string) $namedListTreatment)
573
-		{
526
+	public function setNamedListTreatment($namedListTreatment) {
527
+		switch ((string) $namedListTreatment) {
574 528
 			case Apache_Solr_Service::NAMED_LIST_FLAT:
575 529
 				$this->_namedListTreatment = Apache_Solr_Service::NAMED_LIST_FLAT;
576 530
 				break;
@@ -589,8 +543,7 @@  discard block
 block discarded – undo
589 543
 	 *
590 544
 	 * @return string
591 545
 	 */
592
-	public function getNamedListTreatment()
593
-	{
546
+	public function getNamedListTreatment() {
594 547
 		return $this->_namedListTreatment;
595 548
 	}
596 549
 
@@ -600,8 +553,7 @@  discard block
 block discarded – undo
600 553
 	 *
601 554
 	 * @param string $queryDelimiter
602 555
 	 */
603
-	public function setQueryDelimiter($queryDelimiter)
604
-	{
556
+	public function setQueryDelimiter($queryDelimiter) {
605 557
 		$this->_queryDelimiter = $queryDelimiter;
606 558
 	}
607 559
 
@@ -611,8 +563,7 @@  discard block
 block discarded – undo
611 563
 	 *
612 564
 	 * @param string $queryStringDelimiter
613 565
 	 */
614
-	public function setQueryStringDelimiter($queryStringDelimiter)
615
-	{
566
+	public function setQueryStringDelimiter($queryStringDelimiter) {
616 567
 		$this->_queryStringDelimiter = $queryStringDelimiter;
617 568
 	}
618 569
 
@@ -623,8 +574,7 @@  discard block
 block discarded – undo
623 574
 	 * @param float $timeout maximum time to wait for ping in seconds, -1 for unlimited (default is 2)
624 575
 	 * @return float Actual time taken to ping the server, FALSE if timeout or HTTP error status occurs
625 576
 	 */
626
-	public function ping($timeout = 2)
627
-	{
577
+	public function ping($timeout = 2) {
628 578
 		$start = microtime(true);
629 579
 		
630 580
 		$httpTransport = $this->getHttpTransport();
@@ -632,12 +582,9 @@  discard block
 block discarded – undo
632 582
 		$httpResponse = $httpTransport->performHeadRequest($this->_pingUrl, $timeout);
633 583
 		$solrResponse = new Apache_Solr_Response($httpResponse, $this->_createDocuments, $this->_collapseSingleValueArrays);
634 584
 
635
-		if ($solrResponse->getHttpStatus() == 200)
636
-		{
585
+		if ($solrResponse->getHttpStatus() == 200) {
637 586
 			return microtime(true) - $start;
638
-		}
639
-		else
640
-		{
587
+		} else {
641 588
 			return false;
642 589
 		}
643 590
 	}
@@ -650,8 +597,7 @@  discard block
 block discarded – undo
650 597
 	 *
651 598
 	 * @throws Apache_Solr_HttpTransportException If an error occurs during the service call
652 599
 	 */
653
-	public function threads()
654
-	{
600
+	public function threads() {
655 601
 		return $this->_sendRawGet($this->_threadsUrl);
656 602
 	}
657 603
 
@@ -664,8 +610,7 @@  discard block
 block discarded – undo
664 610
 	 *
665 611
 	 * @throws Apache_Solr_HttpTransportException If an error occurs during the service call
666 612
 	 */
667
-	public function add($rawPost)
668
-	{
613
+	public function add($rawPost) {
669 614
 		return $this->_sendRawPost($this->_updateUrl, $rawPost);
670 615
 	}
671 616
 
@@ -681,8 +626,7 @@  discard block
 block discarded – undo
681 626
 	 *
682 627
 	 * @throws Apache_Solr_HttpTransportException If an error occurs during the service call
683 628
 	 */
684
-	public function addDocument(Apache_Solr_Document $document, $allowDups = false, $overwritePending = true, $overwriteCommitted = true, $commitWithin = 0)
685
-	{
629
+	public function addDocument(Apache_Solr_Document $document, $allowDups = false, $overwritePending = true, $overwriteCommitted = true, $commitWithin = 0) {
686 630
 		$dupValue = $allowDups ? 'true' : 'false';
687 631
 		$pendingValue = $overwritePending ? 'true' : 'false';
688 632
 		$committedValue = $overwriteCommitted ? 'true' : 'false';
@@ -709,8 +653,7 @@  discard block
 block discarded – undo
709 653
 	 *
710 654
 	 * @throws Apache_Solr_HttpTransportException If an error occurs during the service call
711 655
 	 */
712
-	public function addDocuments($documents, $allowDups = false, $overwritePending = true, $overwriteCommitted = true, $commitWithin = 0)
713
-	{
656
+	public function addDocuments($documents, $allowDups = false, $overwritePending = true, $overwriteCommitted = true, $commitWithin = 0) {
714 657
 		$dupValue = $allowDups ? 'true' : 'false';
715 658
 		$pendingValue = $overwritePending ? 'true' : 'false';
716 659
 		$committedValue = $overwriteCommitted ? 'true' : 'false';
@@ -720,10 +663,8 @@  discard block
 block discarded – undo
720 663
 
721 664
 		$rawPost = "<add allowDups=\"{$dupValue}\" overwritePending=\"{$pendingValue}\" overwriteCommitted=\"{$committedValue}\"{$commitWithinString}>";
722 665
 
723
-		foreach ($documents as $document)
724
-		{
725
-			if ($document instanceof Apache_Solr_Document)
726
-			{
666
+		foreach ($documents as $document) {
667
+			if ($document instanceof Apache_Solr_Document) {
727 668
 				$rawPost .= $this->_documentToXmlFragment($document);
728 669
 			}
729 670
 		}
@@ -738,30 +679,24 @@  discard block
 block discarded – undo
738 679
 	 *
739 680
 	 * @return string
740 681
 	 */
741
-	protected function _documentToXmlFragment(Apache_Solr_Document $document)
742
-	{
682
+	protected function _documentToXmlFragment(Apache_Solr_Document $document) {
743 683
 		$xml = '<doc';
744 684
 
745
-		if ($document->getBoost() !== false)
746
-		{
685
+		if ($document->getBoost() !== false) {
747 686
 			$xml .= ' boost="' . $document->getBoost() . '"';
748 687
 		}
749 688
 
750 689
 		$xml .= '>';
751 690
 
752
-		foreach ($document as $key => $value)
753
-		{
691
+		foreach ($document as $key => $value) {
754 692
 			$key = htmlspecialchars($key, ENT_QUOTES, 'UTF-8');
755 693
 			$fieldBoost = $document->getFieldBoost($key);
756 694
 
757
-			if (is_array($value))
758
-			{
759
-				foreach ($value as $multivalue)
760
-				{
695
+			if (is_array($value)) {
696
+				foreach ($value as $multivalue) {
761 697
 					$xml .= '<field name="' . $key . '"';
762 698
 
763
-					if ($fieldBoost !== false)
764
-					{
699
+					if ($fieldBoost !== false) {
765 700
 						$xml .= ' boost="' . $fieldBoost . '"';
766 701
 
767 702
 						// only set the boost for the first field in the set
@@ -772,13 +707,10 @@  discard block
 block discarded – undo
772 707
 
773 708
 					$xml .= '>' . $multivalue . '</field>';
774 709
 				}
775
-			}
776
-			else
777
-			{
710
+			} else {
778 711
 				$xml .= '<field name="' . $key . '"';
779 712
 
780
-				if ($fieldBoost !== false)
781
-				{
713
+				if ($fieldBoost !== false) {
782 714
 					$xml .= ' boost="' . $fieldBoost . '"';
783 715
 				}
784 716
 
@@ -800,8 +732,7 @@  discard block
 block discarded – undo
800 732
 	 * @param string $string
801 733
 	 * @return string
802 734
 	 */
803
-	protected function _stripCtrlChars($string)
804
-	{
735
+	protected function _stripCtrlChars($string) {
805 736
 		// See:  http://w3.org/International/questions/qa-forms-utf-8.html
806 737
 		// Printable utf-8 does not include any of these chars below x7F
807 738
 		return preg_replace('@[\x00-\x08\x0B\x0C\x0E-\x1F]@', ' ', $string);
@@ -818,8 +749,7 @@  discard block
 block discarded – undo
818 749
 	 *
819 750
 	 * @throws Apache_Solr_HttpTransportException If an error occurs during the service call
820 751
 	 */
821
-	public function commit($expungeDeletes = false, $waitFlush = true, $waitSearcher = true, $timeout = 3600)
822
-	{
752
+	public function commit($expungeDeletes = false, $waitFlush = true, $waitSearcher = true, $timeout = 3600) {
823 753
 		$expungeValue = $expungeDeletes ? 'true' : 'false';
824 754
 		$flushValue = $waitFlush ? 'true' : 'false';
825 755
 		$searcherValue = $waitSearcher ? 'true' : 'false';
@@ -839,8 +769,7 @@  discard block
 block discarded – undo
839 769
 	 *
840 770
 	 * @throws Apache_Solr_HttpTransportException If an error occurs during the service call
841 771
 	 */
842
-	public function delete($rawPost, $timeout = 3600)
843
-	{
772
+	public function delete($rawPost, $timeout = 3600) {
844 773
 		return $this->_sendRawPost($this->_updateUrl, $rawPost, $timeout);
845 774
 	}
846 775
 
@@ -855,8 +784,7 @@  discard block
 block discarded – undo
855 784
 	 *
856 785
 	 * @throws Apache_Solr_HttpTransportException If an error occurs during the service call
857 786
 	 */
858
-	public function deleteById($id, $fromPending = true, $fromCommitted = true, $timeout = 3600)
859
-	{
787
+	public function deleteById($id, $fromPending = true, $fromCommitted = true, $timeout = 3600) {
860 788
 		$pendingValue = $fromPending ? 'true' : 'false';
861 789
 		$committedValue = $fromCommitted ? 'true' : 'false';
862 790
 
@@ -879,15 +807,13 @@  discard block
 block discarded – undo
879 807
 	 *
880 808
 	 * @throws Apache_Solr_HttpTransportException If an error occurs during the service call
881 809
 	 */
882
-	public function deleteByMultipleIds($ids, $fromPending = true, $fromCommitted = true, $timeout = 3600)
883
-	{
810
+	public function deleteByMultipleIds($ids, $fromPending = true, $fromCommitted = true, $timeout = 3600) {
884 811
 		$pendingValue = $fromPending ? 'true' : 'false';
885 812
 		$committedValue = $fromCommitted ? 'true' : 'false';
886 813
 
887 814
 		$rawPost = '<delete fromPending="' . $pendingValue . '" fromCommitted="' . $committedValue . '">';
888 815
 
889
-		foreach ($ids as $id)
890
-		{
816
+		foreach ($ids as $id) {
891 817
 			//escape special xml characters
892 818
 			$id = htmlspecialchars($id, ENT_NOQUOTES, 'UTF-8');
893 819
 
@@ -910,8 +836,7 @@  discard block
 block discarded – undo
910 836
 	 *
911 837
 	 * @throws Apache_Solr_HttpTransportException If an error occurs during the service call
912 838
 	 */
913
-	public function deleteByQuery($rawQuery, $fromPending = true, $fromCommitted = true, $timeout = 3600)
914
-	{
839
+	public function deleteByQuery($rawQuery, $fromPending = true, $fromCommitted = true, $timeout = 3600) {
915 840
 		$pendingValue = $fromPending ? 'true' : 'false';
916 841
 		$committedValue = $fromCommitted ? 'true' : 'false';
917 842
 
@@ -941,43 +866,33 @@  discard block
 block discarded – undo
941 866
 	 *
942 867
 	 * @throws Apache_Solr_InvalidArgumentException if $file, $params, or $document are invalid.
943 868
 	 */
944
-	public function extract($file, $params = array(), $document = null, $mimetype = 'application/octet-stream')
945
-	{
869
+	public function extract($file, $params = array(), $document = null, $mimetype = 'application/octet-stream') {
946 870
 		// check if $params is an array (allow null for default empty array)
947
-		if (!is_null($params))
948
-		{
949
-			if (!is_array($params))
950
-			{
871
+		if (!is_null($params)) {
872
+			if (!is_array($params)) {
951 873
 				throw new Apache_Solr_InvalidArgumentException("\$params must be a valid array or null");
952 874
 			}
953
-		}
954
-		else
955
-		{
875
+		} else {
956 876
 			$params = array();
957 877
 		}
958 878
 		
959 879
 		// if $file is an http request, defer to extractFromUrl instead
960
-		if (substr($file, 0, 7) == 'http://' || substr($file, 0, 8) == 'https://')
961
-		{
880
+		if (substr($file, 0, 7) == 'http://' || substr($file, 0, 8) == 'https://') {
962 881
 			return $this->extractFromUrl($file, $params, $document, $mimetype);
963 882
 		}
964 883
 		
965 884
 		// read the contents of the file
966 885
 		$contents = @file_get_contents($file);
967 886
 
968
-		if ($contents !== false)
969
-		{
887
+		if ($contents !== false) {
970 888
 			// add the resource.name parameter if not specified
971
-			if (!isset($params['resource.name']))
972
-			{
889
+			if (!isset($params['resource.name'])) {
973 890
 				$params['resource.name'] = basename($file);
974 891
 			}
975 892
 
976 893
 			// delegate the rest to extractFromString
977 894
 			return $this->extractFromString($contents, $params, $document, $mimetype);
978
-		}
979
-		else
980
-		{
895
+		} else {
981 896
 			throw new Apache_Solr_InvalidArgumentException("File '{$file}' is empty or could not be read");
982 897
 		}
983 898
 	}
@@ -1002,18 +917,13 @@  discard block
 block discarded – undo
1002 917
 	 *
1003 918
 	 * @todo Should be using multipart/form-data to post parameter values, but I could not get my implementation to work. Needs revisisted.
1004 919
 	 */
1005
-	public function extractFromString($data, $params = array(), $document = null, $mimetype = 'application/octet-stream')
1006
-	{
920
+	public function extractFromString($data, $params = array(), $document = null, $mimetype = 'application/octet-stream') {
1007 921
 		// check if $params is an array (allow null for default empty array)
1008
-		if (!is_null($params))
1009
-		{
1010
-			if (!is_array($params))
1011
-			{
922
+		if (!is_null($params)) {
923
+			if (!is_array($params)) {
1012 924
 				throw new Apache_Solr_InvalidArgumentException("\$params must be a valid array or null");
1013 925
 			}
1014
-		}
1015
-		else
1016
-		{
926
+		} else {
1017 927
 			$params = array();
1018 928
 		}
1019 929
 
@@ -1022,16 +932,13 @@  discard block
 block discarded – undo
1022 932
 		$params['json.nl'] = $this->_namedListTreatment;
1023 933
 
1024 934
 		// check if $document is an Apache_Solr_Document instance
1025
-		if (!is_null($document) && $document instanceof Apache_Solr_Document)
1026
-		{
935
+		if (!is_null($document) && $document instanceof Apache_Solr_Document) {
1027 936
 			// iterate document, adding literal.* and boost.* fields to $params as appropriate
1028
-			foreach ($document as $field => $fieldValue)
1029
-			{
937
+			foreach ($document as $field => $fieldValue) {
1030 938
 				// check if we need to add a boost.* parameters
1031 939
 				$fieldBoost = $document->getFieldBoost($field);
1032 940
 
1033
-				if ($fieldBoost !== false)
1034
-				{
941
+				if ($fieldBoost !== false) {
1035 942
 					$params["boost.{$field}"] = $fieldBoost;
1036 943
 				}
1037 944
 
@@ -1065,18 +972,13 @@  discard block
 block discarded – undo
1065 972
 	 *
1066 973
 	 * @throws Apache_Solr_InvalidArgumentException if $url, $params, or $document are invalid.
1067 974
 	 */
1068
-	public function extractFromUrl($url, $params = array(), $document = null, $mimetype = 'application/octet-stream')
1069
-	{
975
+	public function extractFromUrl($url, $params = array(), $document = null, $mimetype = 'application/octet-stream') {
1070 976
 		// check if $params is an array (allow null for default empty array)
1071
-		if (!is_null($params))
1072
-		{
1073
-			if (!is_array($params))
1074
-			{
977
+		if (!is_null($params)) {
978
+			if (!is_array($params)) {
1075 979
 				throw new Apache_Solr_InvalidArgumentException("\$params must be a valid array or null");
1076 980
 			}
1077
-		}
1078
-		else
1079
-		{
981
+		} else {
1080 982
 			$params = array();
1081 983
 		}
1082 984
 
@@ -1086,19 +988,15 @@  discard block
 block discarded – undo
1086 988
 		$httpResponse = $httpTransport->performGetRequest($url);
1087 989
 		
1088 990
 		// check that its a 200 response
1089
-		if ($httpResponse->getStatusCode() == 200)
1090
-		{
991
+		if ($httpResponse->getStatusCode() == 200) {
1091 992
 			// add the resource.name parameter if not specified
1092
-			if (!isset($params['resource.name']))
1093
-			{
993
+			if (!isset($params['resource.name'])) {
1094 994
 				$params['resource.name'] = $url;
1095 995
 			}
1096 996
 
1097 997
 			// delegate the rest to extractFromString
1098 998
 			return $this->extractFromString($httpResponse->getBody(), $params, $document, $mimetype);
1099
-		}
1100
-		else
1101
-		{
999
+		} else {
1102 1000
 			throw new Apache_Solr_InvalidArgumentException("URL '{$url}' returned non 200 response code");
1103 1001
 		}
1104 1002
 	}
@@ -1114,8 +1012,7 @@  discard block
 block discarded – undo
1114 1012
 	 *
1115 1013
 	 * @throws Apache_Solr_HttpTransportException If an error occurs during the service call
1116 1014
 	 */
1117
-	public function optimize($waitFlush = true, $waitSearcher = true, $timeout = 3600)
1118
-	{
1015
+	public function optimize($waitFlush = true, $waitSearcher = true, $timeout = 3600) {
1119 1016
 		$flushValue = $waitFlush ? 'true' : 'false';
1120 1017
 		$searcherValue = $waitSearcher ? 'true' : 'false';
1121 1018
 
@@ -1137,19 +1034,14 @@  discard block
 block discarded – undo
1137 1034
 	 * @throws Apache_Solr_HttpTransportException If an error occurs during the service call
1138 1035
 	 * @throws Apache_Solr_InvalidArgumentException If an invalid HTTP method is used
1139 1036
 	 */
1140
-	public function search($query, $offset = 0, $limit = 10, $params = array(), $method = self::METHOD_GET)
1141
-	{
1037
+	public function search($query, $offset = 0, $limit = 10, $params = array(), $method = self::METHOD_GET) {
1142 1038
 		// ensure params is an array
1143
-		if (!is_null($params))
1144
-		{
1145
-			if (!is_array($params))
1146
-			{
1039
+		if (!is_null($params)) {
1040
+			if (!is_array($params)) {
1147 1041
 				// params was specified but was not an array - invalid
1148 1042
 				throw new Apache_Solr_InvalidArgumentException("\$params must be a valid array or null");
1149 1043
 			}
1150
-		}
1151
-		else
1152
-		{
1044
+		} else {
1153 1045
 			$params = array();
1154 1046
 		}
1155 1047
 		
@@ -1165,16 +1057,11 @@  discard block
 block discarded – undo
1165 1057
 
1166 1058
 		$queryString = $this->_generateQueryString($params);
1167 1059
 
1168
-		if ($method == self::METHOD_GET)
1169
-		{
1060
+		if ($method == self::METHOD_GET) {
1170 1061
 			return $this->_sendRawGet($this->_searchUrl . $this->_queryDelimiter . $queryString);
1171
-		}
1172
-		else if ($method == self::METHOD_POST)
1173
-		{
1062
+		} else if ($method == self::METHOD_POST) {
1174 1063
 			return $this->_sendRawPost($this->_searchUrl, $queryString, FALSE, 'application/x-www-form-urlencoded; charset=UTF-8');
1175
-		}
1176
-		else
1177
-		{
1064
+		} else {
1178 1065
 			throw new Apache_Solr_InvalidArgumentException("Unsupported method '$method', please use the Apache_Solr_Service::METHOD_* constants");
1179 1066
 		}
1180 1067
 	}
Please login to merge, or discard this patch.
dlf/lib/SolrPhpClient/Apache/Solr/HttpTransportException.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -36,8 +36,7 @@  discard block
 block discarded – undo
36 36
  * @author Donovan Jimenez <[email protected]>
37 37
  */
38 38
 
39
-class Apache_Solr_HttpTransportException extends Apache_Solr_Exception
40
-{
39
+class Apache_Solr_HttpTransportException extends Apache_Solr_Exception {
41 40
 	/**
42 41
 	 * SVN Revision meta data for this class
43 42
 	 */
@@ -60,8 +59,7 @@  discard block
 block discarded – undo
60 59
 	 *
61 60
 	 * @param Apache_Solr_Response $response
62 61
 	 */
63
-	public function __construct(Apache_Solr_Response $response)
64
-	{
62
+	public function __construct(Apache_Solr_Response $response) {
65 63
 		parent::__construct("'{$response->getHttpStatus()}' Status: {$response->getHttpStatusMessage()}", $response->getHttpStatus());
66 64
 
67 65
 		$this->_response = $response;
@@ -72,8 +70,7 @@  discard block
 block discarded – undo
72 70
 	 *
73 71
 	 * @return Apache_Solr_Response
74 72
 	 */
75
-	public function getResponse()
76
-	{
73
+	public function getResponse() {
77 74
 		return $this->_response;
78 75
 	}
79 76
 }
80 77
\ No newline at end of file
Please login to merge, or discard this patch.
dlf/lib/SolrPhpClient/Apache/Solr/Exception.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,8 +36,7 @@
 block discarded – undo
36 36
  * @author Donovan Jimenez <[email protected]>
37 37
  */
38 38
 
39
-class Apache_Solr_Exception extends Exception
40
-{
39
+class Apache_Solr_Exception extends Exception {
41 40
 	/**
42 41
 	 * SVN Revision meta data for this class
43 42
 	 */
Please login to merge, or discard this patch.