Passed
Branch oai_solr_new_directory_structu... (24cd44)
by Erik
04:51
created
lib/SolrPhpClient/Apache/Solr/Response.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -217,8 +217,7 @@
 block discarded – undo
217 217
 				if ($this->_createDocuments)
218 218
 				{
219 219
 					$document = new Apache_Solr_Document();
220
-				}
221
-				else
220
+				} else
222 221
 				{
223 222
 					$document = $originalDocument;
224 223
 				}
Please login to merge, or discard this patch.
lib/SolrPhpClient/Apache/Solr/Document.php 1 patch
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -121,8 +121,7 @@  discard block
 block discarded – undo
121 121
 		if ($boost > 0.0)
122 122
 		{
123 123
 			$this->_documentBoost = $boost;
124
-		}
125
-		else
124
+		} else
126 125
 		{
127 126
 			$this->_documentBoost = false;
128 127
 		}
@@ -157,8 +156,7 @@  discard block
 block discarded – undo
157 156
 		{
158 157
 			// create holding array if this is the first value
159 158
 			$this->_fields[$key] = array();
160
-		}
161
-		else if (!is_array($this->_fields[$key]))
159
+		} else if (!is_array($this->_fields[$key]))
162 160
 		{
163 161
 			// move existing value into array if it is not already an array
164 162
 			$this->_fields[$key] = array($this->_fields[$key]);
@@ -168,8 +166,7 @@  discard block
 block discarded – undo
168 166
 		{
169 167
 			// boost not already set, set it now
170 168
 			$this->setFieldBoost($key, $boost);
171
-		}
172
-		else if ((float) $boost > 0.0)
169
+		} else if ((float) $boost > 0.0)
173 170
 		{
174 171
 			// multiply passed boost with current field boost - similar to SolrJ implementation
175 172
 			$this->_fieldBoosts[$key] *= (float) $boost;
@@ -252,8 +249,7 @@  discard block
 block discarded – undo
252 249
 		if ($boost > 0.0)
253 250
 		{
254 251
 			$this->_fieldBoosts[$key] = $boost;
255
-		}
256
-		else
252
+		} else
257 253
 		{
258 254
 			$this->_fieldBoosts[$key] = false;
259 255
 		}
Please login to merge, or discard this patch.
lib/SolrPhpClient/Apache/Solr/Service/Balancer.php 1 patch
Braces   +61 added lines, -62 removed lines patch added patch discarded remove patch
@@ -176,16 +176,14 @@  discard block
 block discarded – undo
176 176
 			$id = $this->_getServiceId($service->getHost(), $service->getPort(), $service->getPath());
177 177
 
178 178
 			$this->_readableServices[$id] = $service;
179
-		}
180
-		else if (is_array($service))
179
+		} else if (is_array($service))
181 180
 		{
182 181
 			if (isset($service['host']) && isset($service['port']) && isset($service['path']))
183 182
 			{
184 183
 				$id = $this->_getServiceId((string)$service['host'], (int)$service['port'], (string)$service['path']);
185 184
 
186 185
 				$this->_readableServices[$id] = $service;
187
-			}
188
-			else
186
+			} else
189 187
 			{
190 188
 				throw new Apache_Solr_InvalidArgumentException('A Readable Service description array does not have all required elements of host, port, and path');
191 189
 			}
@@ -206,19 +204,16 @@  discard block
 block discarded – undo
206 204
 		if ($service instanceof Apache_Solr_Service)
207 205
 		{
208 206
 			$id = $this->_getServiceId($service->getHost(), $service->getPort(), $service->getPath());
209
-		}
210
-		else if (is_array($service))
207
+		} else if (is_array($service))
211 208
 		{
212 209
 			if (isset($service['host']) && isset($service['port']) && isset($service['path']))
213 210
 			{
214 211
 				$id = $this->_getServiceId((string)$service['host'], (int)$service['port'], (string)$service['path']);
215
-			}
216
-			else
212
+			} else
217 213
 			{
218 214
 				throw new Apache_Solr_InvalidArgumentException('A Readable Service description array does not have all required elements of host, port, and path');
219 215
 			}
220
-		}
221
-		else if (is_string($service))
216
+		} else if (is_string($service))
222 217
 		{
223 218
 			$id = $service;
224 219
 		}
@@ -244,16 +239,14 @@  discard block
 block discarded – undo
244 239
 			$id = $this->_getServiceId($service->getHost(), $service->getPort(), $service->getPath());
245 240
 
246 241
 			$this->_writeableServices[$id] = $service;
247
-		}
248
-		else if (is_array($service))
242
+		} else if (is_array($service))
249 243
 		{
250 244
 			if (isset($service['host']) && isset($service['port']) && isset($service['path']))
251 245
 			{
252 246
 				$id = $this->_getServiceId((string)$service['host'], (int)$service['port'], (string)$service['path']);
253 247
 
254 248
 				$this->_writeableServices[$id] = $service;
255
-			}
256
-			else
249
+			} else
257 250
 			{
258 251
 				throw new Apache_Solr_InvalidArgumentException('A Writeable Service description array does not have all required elements of host, port, and path');
259 252
 			}
@@ -274,19 +267,16 @@  discard block
 block discarded – undo
274 267
 		if ($service instanceof Apache_Solr_Service)
275 268
 		{
276 269
 			$id = $this->_getServiceId($service->getHost(), $service->getPort(), $service->getPath());
277
-		}
278
-		else if (is_array($service))
270
+		} else if (is_array($service))
279 271
 		{
280 272
 			if (isset($service['host']) && isset($service['port']) && isset($service['path']))
281 273
 			{
282 274
 				$id = $this->_getServiceId((string)$service['host'], (int)$service['port'], (string)$service['path']);
283
-			}
284
-			else
275
+			} else
285 276
 			{
286 277
 				throw new Apache_Solr_InvalidArgumentException('A Readable Service description array does not have all required elements of host, port, and path');
287 278
 			}
288
-		}
289
-		else if (is_string($service))
279
+		} else if (is_string($service))
290 280
 		{
291 281
 			$id = $service;
292 282
 		}
@@ -335,8 +325,7 @@  discard block
 block discarded – undo
335 325
 
336 326
 				$service->setCreateDocuments($this->_createDocuments);
337 327
 				$this->_currentReadService = $id;
338
-			}
339
-			else
328
+			} else
340 329
 			{
341 330
 				throw new Apache_Solr_NoServiceAvailableException('No read services were available');
342 331
 			}
@@ -387,8 +376,7 @@  discard block
 block discarded – undo
387 376
 				}
388 377
 
389 378
 				$this->_currentWriteService = $id;
390
-			}
391
-			else
379
+			} else
392 380
 			{
393 381
 				throw new Apache_Solr_NoServiceAvailableException('No write services were available');
394 382
 			}
@@ -441,8 +429,7 @@  discard block
 block discarded – undo
441 429
 					}
442 430
 
443 431
 				} while($this->_writeableServices[$this->_currentWriteService]->ping($backoff) === false);
444
-			}
445
-			else
432
+			} else
446 433
 			{
447 434
 				throw new Apache_Solr_NoServiceAvailableException('No write services were available');
448 435
 			}
@@ -497,13 +484,14 @@  discard block
 block discarded – undo
497 484
 			try
498 485
 			{
499 486
 				return $service->add($rawPost);
500
-			}
501
-			catch (Apache_Solr_HttpTransportException $e)
487
+			} catch (Apache_Solr_HttpTransportException $e)
502 488
 			{
503
-				if ($e->getCode() != 0) //IF NOT COMMUNICATION ERROR
489
+				if ($e->getCode() != 0) {
490
+					//IF NOT COMMUNICATION ERROR
504 491
 				{
505 492
 					throw $e;
506 493
 				}
494
+				}
507 495
 			}
508 496
 
509 497
 			$service = $this->_selectWriteService(true);
@@ -532,13 +520,14 @@  discard block
 block discarded – undo
532 520
 			try
533 521
 			{
534 522
 				return $service->addDocument($document, $allowDups, $overwritePending, $overwriteCommitted);
535
-			}
536
-			catch (Apache_Solr_HttpTransportException $e)
523
+			} catch (Apache_Solr_HttpTransportException $e)
537 524
 			{
538
-				if ($e->getCode() != 0) //IF NOT COMMUNICATION ERROR
525
+				if ($e->getCode() != 0) {
526
+					//IF NOT COMMUNICATION ERROR
539 527
 				{
540 528
 					throw $e;
541 529
 				}
530
+				}
542 531
 			}
543 532
 
544 533
 			$service = $this->_selectWriteService(true);
@@ -567,13 +556,14 @@  discard block
 block discarded – undo
567 556
 			try
568 557
 			{
569 558
 				return $service->addDocuments($documents, $allowDups, $overwritePending, $overwriteCommitted);
570
-			}
571
-			catch (Apache_Solr_HttpTransportException $e)
559
+			} catch (Apache_Solr_HttpTransportException $e)
572 560
 			{
573
-				if ($e->getCode() != 0) //IF NOT COMMUNICATION ERROR
561
+				if ($e->getCode() != 0) {
562
+					//IF NOT COMMUNICATION ERROR
574 563
 				{
575 564
 					throw $e;
576 565
 				}
566
+				}
577 567
 			}
578 568
 
579 569
 			$service = $this->_selectWriteService(true);
@@ -601,13 +591,14 @@  discard block
 block discarded – undo
601 591
 			try
602 592
 			{
603 593
 				return $service->commit($optimize, $waitFlush, $waitSearcher, $timeout);
604
-			}
605
-			catch (Apache_Solr_HttpTransportException $e)
594
+			} catch (Apache_Solr_HttpTransportException $e)
606 595
 			{
607
-				if ($e->getCode() != 0) //IF NOT COMMUNICATION ERROR
596
+				if ($e->getCode() != 0) {
597
+					//IF NOT COMMUNICATION ERROR
608 598
 				{
609 599
 					throw $e;
610 600
 				}
601
+				}
611 602
 			}
612 603
 
613 604
 			$service = $this->_selectWriteService(true);
@@ -635,13 +626,14 @@  discard block
 block discarded – undo
635 626
 			try
636 627
 			{
637 628
 				return $service->delete($rawPost, $timeout);
638
-			}
639
-			catch (Apache_Solr_HttpTransportException $e)
629
+			} catch (Apache_Solr_HttpTransportException $e)
640 630
 			{
641
-				if ($e->getCode() != 0) //IF NOT COMMUNICATION ERROR
631
+				if ($e->getCode() != 0) {
632
+					//IF NOT COMMUNICATION ERROR
642 633
 				{
643 634
 					throw $e;
644 635
 				}
636
+				}
645 637
 			}
646 638
 
647 639
 			$service = $this->_selectWriteService(true);
@@ -670,13 +662,14 @@  discard block
 block discarded – undo
670 662
 			try
671 663
 			{
672 664
 				return $service->deleteById($id, $fromPending, $fromCommitted, $timeout);
673
-			}
674
-			catch (Apache_Solr_HttpTransportException $e)
665
+			} catch (Apache_Solr_HttpTransportException $e)
675 666
 			{
676
-				if ($e->getCode() != 0) //IF NOT COMMUNICATION ERROR
667
+				if ($e->getCode() != 0) {
668
+					//IF NOT COMMUNICATION ERROR
677 669
 				{
678 670
 					throw $e;
679 671
 				}
672
+				}
680 673
 			}
681 674
 
682 675
 			$service = $this->_selectWriteService(true);
@@ -705,13 +698,14 @@  discard block
 block discarded – undo
705 698
 			try
706 699
 			{
707 700
 				return $service->deleteByMultipleId($ids, $fromPending, $fromCommitted, $timeout);
708
-			}
709
-			catch (Apache_Solr_HttpTransportException $e)
701
+			} catch (Apache_Solr_HttpTransportException $e)
710 702
 			{
711
-				if ($e->getCode() != 0) //IF NOT COMMUNICATION ERROR
703
+				if ($e->getCode() != 0) {
704
+					//IF NOT COMMUNICATION ERROR
712 705
 				{
713 706
 					throw $e;
714 707
 				}
708
+				}
715 709
 			}
716 710
 
717 711
 			$service = $this->_selectWriteService(true);
@@ -740,13 +734,14 @@  discard block
 block discarded – undo
740 734
 			try
741 735
 			{
742 736
 				return $service->deleteByQuery($rawQuery, $fromPending, $fromCommitted, $timeout);
743
-			}
744
-			catch (Apache_Solr_HttpTransportException $e)
737
+			} catch (Apache_Solr_HttpTransportException $e)
745 738
 			{
746
-				if ($e->getCode() != 0) //IF NOT COMMUNICATION ERROR
739
+				if ($e->getCode() != 0) {
740
+					//IF NOT COMMUNICATION ERROR
747 741
 				{
748 742
 					throw $e;
749 743
 				}
744
+				}
750 745
 			}
751 746
 
752 747
 			$service = $this->_selectWriteService(true);
@@ -782,13 +777,14 @@  discard block
 block discarded – undo
782 777
 			try
783 778
 			{
784 779
 				return $service->extract($file, $params, $document, $mimetype);
785
-			}
786
-			catch (Apache_Solr_HttpTransportException $e)
780
+			} catch (Apache_Solr_HttpTransportException $e)
787 781
 			{
788
-				if ($e->getCode() != 0) //IF NOT COMMUNICATION ERROR
782
+				if ($e->getCode() != 0) {
783
+					//IF NOT COMMUNICATION ERROR
789 784
 				{
790 785
 					throw $e;
791 786
 				}
787
+				}
792 788
 			}
793 789
 
794 790
 			$service = $this->_selectWriteService(true);
@@ -826,13 +822,14 @@  discard block
 block discarded – undo
826 822
 			try
827 823
 			{
828 824
 				return $service->extractFromString($data, $params, $document, $mimetype);
829
-			}
830
-			catch (Apache_Solr_HttpTransportException $e)
825
+			} catch (Apache_Solr_HttpTransportException $e)
831 826
 			{
832
-				if ($e->getCode() != 0) //IF NOT COMMUNICATION ERROR
827
+				if ($e->getCode() != 0) {
828
+					//IF NOT COMMUNICATION ERROR
833 829
 				{
834 830
 					throw $e;
835 831
 				}
832
+				}
836 833
 			}
837 834
 
838 835
 			$service = $this->_selectWriteService(true);
@@ -861,13 +858,14 @@  discard block
 block discarded – undo
861 858
 			try
862 859
 			{
863 860
 				return $service->optimize($waitFlush, $waitSearcher, $timeout);
864
-			}
865
-			catch (Apache_Solr_HttpTransportException $e)
861
+			} catch (Apache_Solr_HttpTransportException $e)
866 862
 			{
867
-				if ($e->getCode() != 0) //IF NOT COMMUNICATION ERROR
863
+				if ($e->getCode() != 0) {
864
+					//IF NOT COMMUNICATION ERROR
868 865
 				{
869 866
 					throw $e;
870 867
 				}
868
+				}
871 869
 			}
872 870
 
873 871
 			$service = $this->_selectWriteService(true);
@@ -897,13 +895,14 @@  discard block
 block discarded – undo
897 895
 			try
898 896
 			{
899 897
 				return $service->search($query, $offset, $limit, $params, $method);
900
-			}
901
-			catch (Apache_Solr_HttpTransportException $e)
898
+			} catch (Apache_Solr_HttpTransportException $e)
902 899
 			{
903
-				if ($e->getCode() != 0) //IF NOT COMMUNICATION ERROR
900
+				if ($e->getCode() != 0) {
901
+					//IF NOT COMMUNICATION ERROR
904 902
 				{
905 903
 					throw $e;
906 904
 				}
905
+				}
907 906
 			}
908 907
 
909 908
 			$service = $this->_selectReadService(true);
Please login to merge, or discard this patch.
lib/SolrPhpClient/Apache/Solr/Service.php 1 patch
Braces   +14 added lines, -28 removed lines patch added patch discarded remove patch
@@ -268,8 +268,7 @@  discard block
 block discarded – undo
268 268
 			}
269 269
 
270 270
 			$queryString = $this->_queryDelimiter . implode($this->_queryStringDelimiter, $escapedParams);
271
-		}
272
-		else
271
+		} else
273 272
 		{
274 273
 			$queryString = '';
275 274
 		}
@@ -309,8 +308,7 @@  discard block
 block discarded – undo
309 308
 		{
310 309
 			$queryString = http_build_query($params, null, $this->_queryStringDelimiter);
311 310
 			return preg_replace('/%5B(?:[0-9]|[1-9][0-9]+)%5D=/', '=', $queryString);
312
-		}
313
-		else
311
+		} else
314 312
 		{
315 313
 			$queryString = http_build_query($params);
316 314
 			return preg_replace('/\\[(?:[0-9]|[1-9][0-9]+)\\]=/', '=', $queryString);
@@ -390,8 +388,7 @@  discard block
 block discarded – undo
390 388
 		if (empty($host))
391 389
 		{
392 390
 			throw new Apache_Solr_InvalidArgumentException('Host parameter is empty');
393
-		}
394
-		else
391
+		} else
395 392
 		{
396 393
 			$this->_host = $host;
397 394
 		}
@@ -427,8 +424,7 @@  discard block
 block discarded – undo
427 424
 		if ($port <= 0)
428 425
 		{
429 426
 			throw new Apache_Solr_InvalidArgumentException('Port is not a valid port number');
430
-		}
431
-		else
427
+		} else
432 428
 		{
433 429
 			$this->_port = $port;
434 430
 		}
@@ -635,8 +631,7 @@  discard block
 block discarded – undo
635 631
 		if ($solrResponse->getHttpStatus() == 200)
636 632
 		{
637 633
 			return microtime(true) - $start;
638
-		}
639
-		else
634
+		} else
640 635
 		{
641 636
 			return false;
642 637
 		}
@@ -772,8 +767,7 @@  discard block
 block discarded – undo
772 767
 
773 768
 					$xml .= '>' . $multivalue . '</field>';
774 769
 				}
775
-			}
776
-			else
770
+			} else
777 771
 			{
778 772
 				$xml .= '<field name="' . $key . '"';
779 773
 
@@ -950,8 +944,7 @@  discard block
 block discarded – undo
950 944
 			{
951 945
 				throw new Apache_Solr_InvalidArgumentException("\$params must be a valid array or null");
952 946
 			}
953
-		}
954
-		else
947
+		} else
955 948
 		{
956 949
 			$params = array();
957 950
 		}
@@ -975,8 +968,7 @@  discard block
 block discarded – undo
975 968
 
976 969
 			// delegate the rest to extractFromString
977 970
 			return $this->extractFromString($contents, $params, $document, $mimetype);
978
-		}
979
-		else
971
+		} else
980 972
 		{
981 973
 			throw new Apache_Solr_InvalidArgumentException("File '{$file}' is empty or could not be read");
982 974
 		}
@@ -1011,8 +1003,7 @@  discard block
 block discarded – undo
1011 1003
 			{
1012 1004
 				throw new Apache_Solr_InvalidArgumentException("\$params must be a valid array or null");
1013 1005
 			}
1014
-		}
1015
-		else
1006
+		} else
1016 1007
 		{
1017 1008
 			$params = array();
1018 1009
 		}
@@ -1074,8 +1065,7 @@  discard block
 block discarded – undo
1074 1065
 			{
1075 1066
 				throw new Apache_Solr_InvalidArgumentException("\$params must be a valid array or null");
1076 1067
 			}
1077
-		}
1078
-		else
1068
+		} else
1079 1069
 		{
1080 1070
 			$params = array();
1081 1071
 		}
@@ -1096,8 +1086,7 @@  discard block
 block discarded – undo
1096 1086
 
1097 1087
 			// delegate the rest to extractFromString
1098 1088
 			return $this->extractFromString($httpResponse->getBody(), $params, $document, $mimetype);
1099
-		}
1100
-		else
1089
+		} else
1101 1090
 		{
1102 1091
 			throw new Apache_Solr_InvalidArgumentException("URL '{$url}' returned non 200 response code");
1103 1092
 		}
@@ -1147,8 +1136,7 @@  discard block
 block discarded – undo
1147 1136
 				// params was specified but was not an array - invalid
1148 1137
 				throw new Apache_Solr_InvalidArgumentException("\$params must be a valid array or null");
1149 1138
 			}
1150
-		}
1151
-		else
1139
+		} else
1152 1140
 		{
1153 1141
 			$params = array();
1154 1142
 		}
@@ -1168,12 +1156,10 @@  discard block
 block discarded – undo
1168 1156
 		if ($method == self::METHOD_GET)
1169 1157
 		{
1170 1158
 			return $this->_sendRawGet($this->_searchUrl . $this->_queryDelimiter . $queryString);
1171
-		}
1172
-		else if ($method == self::METHOD_POST)
1159
+		} else if ($method == self::METHOD_POST)
1173 1160
 		{
1174 1161
 			return $this->_sendRawPost($this->_searchUrl, $queryString, FALSE, 'application/x-www-form-urlencoded; charset=UTF-8');
1175
-		}
1176
-		else
1162
+		} else
1177 1163
 		{
1178 1164
 			throw new Apache_Solr_InvalidArgumentException("Unsupported method '$method', please use the Apache_Solr_Service::METHOD_* constants");
1179 1165
 		}
Please login to merge, or discard this patch.
lib/SolrPhpClient/Apache/Solr/HttpTransport/FileGetContents.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -81,8 +81,7 @@
 block discarded – undo
81 81
 			$timeout = (float) $timeout / 2;
82 82
 
83 83
 			stream_context_set_option($this->_getContext, 'http', 'timeout', $timeout);
84
-		}
85
-		else
84
+		} else
86 85
 		{
87 86
 			// use the default timeout pulled from default_socket_timeout otherwise
88 87
 			stream_context_set_option($this->_getContext, 'http', 'timeout', $this->getDefaultTimeout());
Please login to merge, or discard this patch.