Skip to content

Commit ad3db43

Browse files
committed
Use PSR-2 coding standard
- http://www.php-fig.org/psr/psr-2
1 parent 65f1676 commit ad3db43

File tree

155 files changed

+268
-466
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

155 files changed

+268
-466
lines changed

benchmarks/Elasticsearch/Benchmarks/AsyncVsSyncIndexingEvent.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ class AsyncVsSyncIndexingEvent extends AthleticEvent
2525

2626
protected function classSetUp()
2727
{
28-
2928
$this->client = $client = Client::newBuilder()->setHosts(['127.0.0.1:9200'])->build();
3029

3130
$this->setupClient = $client = Client::newBuilder()->setHosts(['127.0.0.1:9200'])->build();
@@ -53,7 +52,6 @@ protected function classSetUp()
5352
$this->largeDocument['body']['testField'] = str_repeat('a', 5000);
5453
$this->largeDocument['index'] = 'benchmarking_index';
5554
$this->largeDocument['type'] = 'test';
56-
5755
}
5856

5957
protected function classTearDown()
@@ -153,5 +151,4 @@ public function asyncLarge()
153151

154152
$responses[999]->wait();
155153
}
156-
157-
}
154+
}

benchmarks/Elasticsearch/Benchmarks/SequentialIndexingEvent.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ class SequentialIndexingEvent extends AthleticEvent
2525

2626
protected function classSetUp()
2727
{
28-
2928
$this->client = $client = Client::newBuilder()->setHosts(['127.0.0.1:9200'])->build();
3029

3130
$this->setupClient = $client = Client::newBuilder()->setHosts(['127.0.0.1:9200'])->build();
@@ -53,7 +52,6 @@ protected function classSetUp()
5352
$this->largeDocument['body']['testField'] = str_repeat('a', 5000);
5453
$this->largeDocument['index'] = 'benchmarking_index';
5554
$this->largeDocument['type'] = 'test';
56-
5755
}
5856

5957
protected function classTearDown()
@@ -132,5 +130,4 @@ public function asyncLarge()
132130
$response = $this->client->index($asyncDoc);
133131
$response = $response['body']['created'];
134132
}
135-
136-
}
133+
}

src/Elasticsearch/Client.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
namespace Elasticsearch;
99

10-
1110
use Elasticsearch\Common\Exceptions;
1211
use Elasticsearch\Common\Exceptions\Missing404Exception;
1312
use Elasticsearch\Endpoints;
@@ -86,11 +85,10 @@ public function __construct(Transport $transport, callable $endpoint)
8685
$this->transport = $transport;
8786
$this->endpoints = $endpoint;
8887
$this->indices = new IndicesNamespace($transport, $endpoint);
89-
$this->cluster = new ClusterNamespace($transport, $endpoint);;
88+
$this->cluster = new ClusterNamespace($transport, $endpoint);
9089
$this->nodes = new NodesNamespace($transport, $endpoint);
9190
$this->snapshot = new SnapshotNamespace($transport, $endpoint);
9291
$this->cat = new CatNamespace($transport, $endpoint);
93-
9492
}
9593

9694

@@ -100,7 +98,6 @@ public function __construct(Transport $transport, callable $endpoint)
10098
*/
10199
public function info($params = [])
102100
{
103-
104101
/** @var callback $endpointBuilder */
105102
$endpointBuilder = $this->endpoints;
106103

@@ -113,7 +110,6 @@ public function info($params = [])
113110

114111
public function ping($params = [])
115112
{
116-
117113
/** @var callback $endpointBuilder */
118114
$endpointBuilder = $this->endpoints;
119115

@@ -123,7 +119,6 @@ public function ping($params = [])
123119
try {
124120
$response = $endpoint->setParams($params)->performRequest();
125121
$endpoint->resultOrFuture($response);
126-
127122
} catch (Missing404Exception $exception) {
128123
return false;
129124
}
@@ -563,7 +558,6 @@ public function exists($params)
563558
$endpoint->setParams($params);
564559

565560
return BooleanRequestWrapper::performRequest($endpoint);
566-
567561
}
568562

569563

@@ -1390,6 +1384,4 @@ public function extractArgument(&$params, $arg)
13901384
return null;
13911385
}
13921386
}
1393-
1394-
13951387
}

src/Elasticsearch/ClientBuilder.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace Elasticsearch;
44

5-
65
use Elasticsearch\Common\Exceptions\InvalidArgumentException;
76
use Elasticsearch\ConnectionPool\AbstractConnectionPool;
87
use Elasticsearch\ConnectionPool\Selectors\SelectorInterface;
@@ -26,7 +25,6 @@
2625

2726
class ClientBuilder
2827
{
29-
3028
/** @var Transport */
3129
private $transport;
3230

@@ -173,7 +171,7 @@ public function setConnectionPool($connectionPool, array $args = null)
173171
if (is_string($connectionPool)) {
174172
$this->connectionPool = $connectionPool;
175173
$this->connectionPoolArgs = $args;
176-
} else if (is_object($connectionPool)) {
174+
} elseif (is_object($connectionPool)) {
177175
$this->connectionPool = $connectionPool;
178176
} else {
179177
throw new InvalidArgumentException("Serializer must be a class path or instantiated object extending AbstractConnectionPool");
@@ -398,7 +396,6 @@ public function build()
398396
}
399397

400398
return new Client($this->transport, $this->endpoint);
401-
402399
}
403400

404401

@@ -446,7 +443,7 @@ private function parseStringOrObject($arg, &$destination, $interface)
446443
{
447444
if (is_string($arg)) {
448445
$destination = new $arg;
449-
} else if (is_object($arg)) {
446+
} elseif (is_object($arg)) {
450447
$destination = $arg;
451448
} else {
452449
throw new InvalidArgumentException("Serializer must be a class path or instantiated object implementing $interface");
@@ -518,6 +515,4 @@ private function prependMissingScheme($host)
518515
}
519516
return $host;
520517
}
521-
522-
523518
}

src/Elasticsearch/Common/EmptyLogger.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
namespace Elasticsearch\Common;
99

10-
1110
use Psr\Log\AbstractLogger;
1211
use Psr\Log\LoggerInterface;
1312

@@ -24,4 +23,4 @@ public function log($level, $message, array $context = array())
2423
{
2524
return;
2625
}
27-
}
26+
}

src/Elasticsearch/Common/Exceptions/Curl/OperationTimeoutException.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
namespace Elasticsearch\Common\Exceptions\Curl;
99

10-
1110
use Elasticsearch\Common\Exceptions\ElasticsearchException;
1211
use Elasticsearch\Common\Exceptions\TransportException;
1312

src/Elasticsearch/ConnectionPool/AbstractConnectionPool.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,26 @@
77

88
namespace Elasticsearch\ConnectionPool;
99

10-
1110
use Elasticsearch\Common\Exceptions\InvalidArgumentException;
1211
use Elasticsearch\ConnectionPool\Selectors\SelectorInterface;
1312
use Elasticsearch\Connections\Connection;
1413
use Elasticsearch\Connections\ConnectionFactory;
1514

1615
abstract class AbstractConnectionPool implements ConnectionPoolInterface
1716
{
18-
1917
/**
2018
* Array of connections
2119
*
2220
* @var Connection[]
2321
*/
24-
protected $connections;
22+
protected $connections;
2523

2624
/**
2725
* Array of initial seed connections
2826
*
2927
* @var Connection[]
3028
*/
31-
protected $seedConnections;
29+
protected $seedConnections;
3230

3331
/**
3432
* Selector object, used to select a connection on each request
@@ -60,7 +58,6 @@ public function __construct($connections, SelectorInterface $selector, Connectio
6058
$this->selector = $selector;
6159
$this->connectionPoolParams = $connectionPoolParams;
6260
$this->connectionFactory = $factory;
63-
6461
}
6562

6663

@@ -72,5 +69,4 @@ public function __construct($connections, SelectorInterface $selector, Connectio
7269
abstract public function nextConnection($force = false);
7370

7471
abstract public function scheduleCheck();
75-
76-
}
72+
}

src/Elasticsearch/ConnectionPool/ConnectionPoolInterface.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@
99

1010
namespace Elasticsearch\ConnectionPool;
1111

12-
1312
use Elasticsearch\Connections\ConnectionInterface;
1413

15-
interface ConnectionPoolInterface {
16-
14+
interface ConnectionPoolInterface
15+
{
1716
/**
1817
* @param bool $force
1918
*
@@ -25,5 +24,4 @@ public function nextConnection($force = false);
2524
* @return void
2625
*/
2726
public function scheduleCheck();
28-
29-
}
27+
}

src/Elasticsearch/ConnectionPool/Selectors/RandomSelector.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
*/
2121
class RandomSelector implements SelectorInterface
2222
{
23-
24-
2523
/**
2624
* Select a random connection from the provided array
2725
*
@@ -32,8 +30,5 @@ class RandomSelector implements SelectorInterface
3230
public function select($connections)
3331
{
3432
return $connections[array_rand($connections)];
35-
3633
}
37-
38-
39-
}//end class
34+
}//end class

src/Elasticsearch/ConnectionPool/Selectors/RoundRobinSelector.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
namespace Elasticsearch\ConnectionPool\Selectors;
99

10-
1110
use Elasticsearch\Connections\ConnectionInterface;
1211

1312
/**
@@ -21,7 +20,6 @@
2120
*/
2221
class RoundRobinSelector implements SelectorInterface
2322
{
24-
2523
/**
2624
* @var int
2725
*/
@@ -40,8 +38,5 @@ public function select($connections)
4038
$this->current += 1;
4139

4240
return $connections[$this->current % count($connections)];
43-
4441
}
45-
46-
47-
}//end class
42+
}//end class

src/Elasticsearch/ConnectionPool/Selectors/SelectorInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@
1010
interface SelectorInterface
1111
{
1212
public function select($connections);
13-
}
13+
}

src/Elasticsearch/ConnectionPool/Selectors/StickyRoundRobinSelector.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
namespace Elasticsearch\ConnectionPool\Selectors;
99

10-
1110
use Elasticsearch\Connections\ConnectionInterface;
1211

1312
/**
@@ -21,7 +20,6 @@
2120
*/
2221
class StickyRoundRobinSelector implements SelectorInterface
2322
{
24-
2523
/**
2624
* @var int
2725
*/
@@ -48,7 +46,5 @@ public function select($connections)
4846
$this->current = $this->currentCounter % count($connections);
4947

5048
return $connections[$this->current];
51-
5249
}
53-
54-
}
50+
}

src/Elasticsearch/ConnectionPool/SniffingConnectionPool.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
namespace Elasticsearch\ConnectionPool;
99

10-
1110
use Elasticsearch\Common\Exceptions\Curl\OperationTimeoutException;
1211
use Elasticsearch\Common\Exceptions\NoNodesAvailableException;
1312
use Elasticsearch\ConnectionPool\Selectors\SelectorInterface;
@@ -55,8 +54,6 @@ public function nextConnection($force = false)
5554
}
5655

5756
return $this->nextConnection(true);
58-
59-
6057
}
6158

6259
public function scheduleCheck()
@@ -152,7 +149,6 @@ private function parseClusterState($transportSchema, $nodeInfo)
152149
}
153150

154151
return $hosts;
155-
156152
}
157153

158154
private function setConnectionPoolParams($connectionPoolParams)
@@ -161,4 +157,4 @@ private function setConnectionPoolParams($connectionPoolParams)
161157
$this->sniffingInterval = $connectionPoolParams['sniffingInterval'];
162158
}
163159
}
164-
}
160+
}

src/Elasticsearch/ConnectionPool/StaticConnectionPool.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
namespace Elasticsearch\ConnectionPool;
99

10-
1110
use Elasticsearch\Common\Exceptions\NoNodesAvailableException;
1211
use Elasticsearch\ConnectionPool\Selectors\SelectorInterface;
1312
use Elasticsearch\Connections\Connection;
@@ -40,7 +39,7 @@ public function nextConnection($force = false)
4039
/** @var Connection $connection */
4140
$connection = $this->selector->select($this->connections);
4241
if ($connection->isAlive() === true) {
43-
return $connection;
42+
return $connection;
4443
}
4544

4645
if ($this->readyToRevive($connection) === true) {
@@ -87,4 +86,4 @@ private function readyToRevive(Connection $connection)
8786
return false;
8887
}
8988
}
90-
}
89+
}

src/Elasticsearch/ConnectionPool/StaticNoPingConnectionPool.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ public function nextConnection($force = false)
4949

5050
public function scheduleCheck()
5151
{
52-
5352
}
5453

5554
/**
@@ -70,4 +69,4 @@ private function readyToRevive(Connection $connection)
7069
return false;
7170
}
7271
}
73-
}
72+
}

0 commit comments

Comments
 (0)