Skip to content

Commit a6e852b

Browse files
committed
[SocketClient] Rename Connector::createTcp to Connector::create
1 parent cc7ca13 commit a6e852b

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

Connector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function __construct(LoopInterface $loop, Resolver $resolver)
1919
$this->resolver = $resolver;
2020
}
2121

22-
public function createTcp($host, $port)
22+
public function create($host, $port)
2323
{
2424
$that = $this;
2525

ConnectorInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44

55
interface ConnectorInterface
66
{
7-
public function createTcp($host, $port);
7+
public function create($host, $port);
88
}

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ $dns = $dnsResolverFactory->createCached('8.8.8.8', $loop);
3434
### Async TCP/IP connections
3535

3636
The `React\SocketClient\Connector` provides a single promise-based
37-
`createTcp($host, $ip)` method which resolves as soon as the connection
37+
`create($host, $ip)` method which resolves as soon as the connection
3838
succeeds or fails.
3939

4040
```php
4141
$connector = new React\SocketClient\Connector($loop, $dns);
4242

43-
$connector->createTcp('www.google.com', 80)->then(function (React\Stream\Stream $stream) {
43+
$connector->create('www.google.com', 80)->then(function (React\Stream\Stream $stream) {
4444
$stream->write('...');
4545
$stream->close();
4646
});
@@ -50,13 +50,13 @@ $connector->createTcp('www.google.com', 80)->then(function (React\Stream\Stream
5050

5151
The `SecureConnector` class decorates a given `Connector` instance by enabling
5252
SSL/TLS encryption as soon as the raw TCP/IP connection succeeds. It provides
53-
the same promise- based `createTcp($host, $ip)` method which resolves with
53+
the same promise- based `create($host, $ip)` method which resolves with
5454
a `Stream` instance that can be used just like any non-encrypted stream.
5555

5656
```php
5757
$secureConnector = new React\SocketClient\SecureConnector($connector, $loop);
5858

59-
$secureConnector->createTcp('www.google.com', 443)->then(function (React\Stream\Stream $stream) {
59+
$secureConnector->create('www.google.com', 443)->then(function (React\Stream\Stream $stream) {
6060
$stream->write("GET / HTTP/1.0\r\nHost: www.google.com\r\n\r\n");
6161
...
6262
});

SecureConnector.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ public function __construct(ConnectorInterface $connector, LoopInterface $loop)
1919
$this->streamEncryption = new StreamEncryption($loop);
2020
}
2121

22-
public function createTcp($host, $port)
22+
public function create($host, $port)
2323
{
2424
$streamEncryption = $this->streamEncryption;
25-
return $this->connector->createTcp($host, $port)->then(function (Stream $stream) use ($streamEncryption) {
25+
return $this->connector->create($host, $port)->then(function (Stream $stream) use ($streamEncryption) {
2626
// (unencrypted) connection succeeded => try to enable encryption
2727
return $streamEncryption->enable($stream)->then(null, function ($error) use ($stream) {
2828
// establishing encryption failed => close invalid connection and return error

0 commit comments

Comments
 (0)