-
-
Notifications
You must be signed in to change notification settings - Fork 49
Expand file tree
/
Copy pathConnectorUpcaster.php
More file actions
29 lines (24 loc) · 704 Bytes
/
ConnectorUpcaster.php
File metadata and controls
29 lines (24 loc) · 704 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
namespace Clue\React\Redis;
use React\Socket\ConnectorInterface;
use React\SocketClient\ConnectorInterface as LegacyConnectorInterface;
use React\Stream\DuplexStreamInterface;
/**
* Adapter to upcast a legacy SocketClient:v0.7/v0.6 Connector to a new Socket:v0.8 Connector
*
* @internal
*/
class ConnectorUpcaster implements ConnectorInterface
{
private $legacy;
public function __construct(LegacyConnectorInterface $connector)
{
$this->legacy = $connector;
}
public function connect($uri)
{
return $this->legacy->connect($uri)->then(function (DuplexStreamInterface $stream) {
return new ConnectionUpcaster($stream);
});
}
}