Commit c8ec79a9 authored by Bas de Nooijer's avatar Bas de Nooijer

Merge pull request #347 from basdenooijer/develop

Several small code fixes
parents 81cc8cc7 17c59842
......@@ -27,4 +27,4 @@ matrix:
allow_failures:
- php: 5.3
- php: hhvm
- php: nightly
\ No newline at end of file
- php: nightly
......@@ -4,7 +4,7 @@
"description": "PHP Solr client",
"keywords": ["solr", "search", "php"],
"homepage": "http://www.solarium-project.org",
"license": "NewBSD",
"license": "BSD-3-Clause",
"authors": [
{
"name": "See GitHub contributors",
......
......@@ -59,8 +59,9 @@ abstract class AbstractResponseParser
// key counter to convert values to arrays when keys are re-used
$keys = array();
$dataCount = count($data);
$result = array();
for ($i = 0; $i < count($data); $i += 2) {
for ($i = 0; $i < $dataCount; $i += 2) {
$key = $data[$i];
$value = $data[$i+1];
if (array_key_exists($key, $keys)) {
......
......@@ -40,7 +40,6 @@
namespace Solarium\Plugin\BufferedAdd;
use Solarium\Client;
use Solarium\Core\Plugin\AbstractPlugin;
use Solarium\QueryType\Update\Result as UpdateResult;
use Solarium\QueryType\Update\Query\Query as UpdateQuery;
......
......@@ -41,7 +41,6 @@
namespace Solarium\Plugin\CustomizeRequest;
use Solarium\Core\Plugin\AbstractPlugin;
use Solarium\Core\Client\Request;
use Solarium\Exception\InvalidArgumentException;
use Solarium\Exception\RuntimeException;
use Solarium\Core\Event\Events;
......
......@@ -437,7 +437,7 @@ class Loadbalancer extends AbstractPlugin
$adapter = $this->client->getAdapter();
// save adapter presets (once) to allow the settings to be restored later
if ($this->defaultEndpoint == null) {
if ($this->defaultEndpoint === null) {
$this->defaultEndpoint = $this->client->getEndpoint()->getKey();
}
......@@ -470,7 +470,8 @@ class Loadbalancer extends AbstractPlugin
$adapter = $this->client->getAdapter();
if ($this->getFailoverEnabled() == true) {
for ($i = 0; $i <= $this->getFailoverMaxRetries(); $i++) {
$maxRetries = $this->getFailoverMaxRetries();
for ($i = 0; $i <= $maxRetries; $i++) {
$endpoint = $this->getRandomEndpoint();
try {
return $adapter->execute($request, $endpoint);
......
......@@ -43,9 +43,7 @@ namespace Solarium\Plugin\ParallelExecution;
use Solarium\Core\Plugin\AbstractPlugin;
use Solarium\Core\Client\Endpoint;
use Solarium\Exception\HttpException;
use Solarium\Core\Client\Client;
use Solarium\Core\Query\AbstractQuery;
use Solarium\Core\Query\Result;
use Solarium\Plugin\ParallelExecution\Event\Events;
use Solarium\Plugin\ParallelExecution\Event\ExecuteStart as ExecuteStartEvent;
use Solarium\Plugin\ParallelExecution\Event\ExecuteEnd as ExecuteEndEvent;
......
......@@ -40,7 +40,6 @@
namespace Solarium\Plugin;
use Solarium\Client;
use Solarium\Core\Plugin\AbstractPlugin;
use Solarium\Core\Client\Request;
use Solarium\Core\Event\Events;
......
......@@ -40,7 +40,6 @@
namespace Solarium\Plugin;
use Solarium\Client;
use Solarium\Core\Plugin\AbstractPlugin;
use Solarium\QueryType\Select\Query\Query as SelectQuery;
use Solarium\QueryType\Select\Result\Result as SelectResult;
......
......@@ -36,7 +36,7 @@
// Check phar.readonly ini setting
if (ini_get('phar.readonly') == '1') {
exit("Your php.ini has phar.readonly enabled. Phar cannot be created. Please alter your php.ini first.\n");
throw new \RuntimeException("Your php.ini has phar.readonly enabled. Phar cannot be created. Please alter your php.ini first.\n");
}
// You can optionally use arguments to enable compression and whitespace/comment stripping.
......
......@@ -35,22 +35,20 @@
Phar::mapPhar("solarium.phar");
require_once 'phar://solarium.phar/Autoloader.php';
Solarium_Autoloader::register();
\Solarium\Autoloader::register();
if ('cli' === php_sapi_name() && basename(__FILE__) === basename($_SERVER['argv'][0]) && isset($_SERVER['argv'][1])) {
switch ($_SERVER['argv'][1]) {
case 'version':
echo "Solarium version " . Solarium_Version::VERSION ."\n";
echo "Solarium version " . \Solarium\Client::VERSION ."\n";
break;
default:
echo "Unknown command '" . $_SERVER['argv'][1] . "' (Supported commands: version)\n";
}
exit(0);
}
__halt_compiler();
__HALT_COMPILER();
?>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment