File tree Expand file tree Collapse file tree 4 files changed +4
-11
lines changed Expand file tree Collapse file tree 4 files changed +4
-11
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ local redis server and send some requests:
11
11
12
12
``` php
13
13
14
- $factory = new Factory($loop, $ connector);
14
+ $factory = new Factory($connector);
15
15
$factory->createClient()->then(function (Client $client) use ($loop) {
16
16
$client->SET('greeting', 'Hello world');
17
17
$client->APPEND('greeting', '!');
Original file line number Diff line number Diff line change 11
11
$ factory = new React \Dns \Resolver \Factory ();
12
12
$ resolver = $ factory ->create ('6.6.6.6 ' , $ loop );
13
13
$ connector = new React \SocketClient \Connector ($ loop , $ resolver );
14
- $ factory = new Factory ($ loop , $ connector );
14
+ $ factory = new Factory ($ connector );
15
15
16
16
echo '# connecting to redis... ' . PHP_EOL ;
17
17
Original file line number Diff line number Diff line change 9
9
$ factory = new React \Dns \Resolver \Factory ();
10
10
$ resolver = $ factory ->create ('6.6.6.6 ' , $ loop );
11
11
$ connector = new React \SocketClient \Connector ($ loop , $ resolver );
12
- $ factory = new Factory ($ loop , $ connector );
12
+ $ factory = new Factory ($ connector );
13
13
14
14
$ factory ->createClient ()->then (function (Client $ client ) {
15
15
$ client ->incr ('test ' );
Original file line number Diff line number Diff line change 4
4
5
5
use React \Socket \Server as ServerSocket ;
6
6
use React \Promise \When ;
7
- use React \EventLoop \LoopInterface ;
8
7
use React \SocketClient \ConnectorInterface ;
9
8
use React \Stream \Stream ;
10
9
use Clue \Redis \React \Client ;
16
15
17
16
class Factory
18
17
{
19
- private $ loop ;
20
18
private $ connector ;
21
19
private $ protocol ;
22
20
23
- public function __construct (LoopInterface $ loop , ConnectorInterface $ connector = null , ProtocolFactory $ protocol = null )
21
+ public function __construct (ConnectorInterface $ connector , ProtocolFactory $ protocol = null )
24
22
{
25
- $ this ->loop = $ loop ;
26
23
$ this ->connector = $ connector ;
27
24
28
25
if ($ protocol === null ) {
@@ -96,10 +93,6 @@ private function connect($target)
96
93
return When::reject ($ e );
97
94
}
98
95
99
- if ($ this ->connector === null ) {
100
- return When::reject (new BadMethodCallException ('No Connector instance given in Factory constructor ' ));
101
- }
102
-
103
96
return $ this ->connector ->create ($ parts ['host ' ], $ parts ['port ' ]);
104
97
}
105
98
You can’t perform that action at this time.
0 commit comments