Skip to content

Commit ac1df72

Browse files
committed
Remove uneeded loop argument and require connector
1 parent 541983c commit ac1df72

File tree

4 files changed

+4
-11
lines changed

4 files changed

+4
-11
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ local redis server and send some requests:
1111

1212
```php
1313

14-
$factory = new Factory($loop, $connector);
14+
$factory = new Factory($connector);
1515
$factory->createClient()->then(function (Client $client) use ($loop) {
1616
$client->SET('greeting', 'Hello world');
1717
$client->APPEND('greeting', '!');

example/cli.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
$factory = new React\Dns\Resolver\Factory();
1212
$resolver = $factory->create('6.6.6.6', $loop);
1313
$connector = new React\SocketClient\Connector($loop, $resolver);
14-
$factory = new Factory($loop, $connector);
14+
$factory = new Factory($connector);
1515

1616
echo '# connecting to redis...' . PHP_EOL;
1717

example/client.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
$factory = new React\Dns\Resolver\Factory();
1010
$resolver = $factory->create('6.6.6.6', $loop);
1111
$connector = new React\SocketClient\Connector($loop, $resolver);
12-
$factory = new Factory($loop, $connector);
12+
$factory = new Factory($connector);
1313

1414
$factory->createClient()->then(function (Client $client) {
1515
$client->incr('test');

src/Clue/Redis/React/Factory.php

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

55
use React\Socket\Server as ServerSocket;
66
use React\Promise\When;
7-
use React\EventLoop\LoopInterface;
87
use React\SocketClient\ConnectorInterface;
98
use React\Stream\Stream;
109
use Clue\Redis\React\Client;
@@ -16,13 +15,11 @@
1615

1716
class Factory
1817
{
19-
private $loop;
2018
private $connector;
2119
private $protocol;
2220

23-
public function __construct(LoopInterface $loop, ConnectorInterface $connector = null, ProtocolFactory $protocol = null)
21+
public function __construct(ConnectorInterface $connector, ProtocolFactory $protocol = null)
2422
{
25-
$this->loop = $loop;
2623
$this->connector = $connector;
2724

2825
if ($protocol === null) {
@@ -96,10 +93,6 @@ private function connect($target)
9693
return When::reject($e);
9794
}
9895

99-
if ($this->connector === null) {
100-
return When::reject(new BadMethodCallException('No Connector instance given in Factory constructor'));
101-
}
102-
10396
return $this->connector->create($parts['host'], $parts['port']);
10497
}
10598

0 commit comments

Comments
 (0)