Skip to content

Commit 6c2d77b

Browse files
committed
Update formatting of example code
1 parent 84c35ec commit 6c2d77b

1 file changed

Lines changed: 21 additions & 21 deletions

File tree

README.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ factory. All you need to give it is a nameserver, then you can start resolving
1515
names, baby!
1616

1717
```php
18-
$loop = React\EventLoop\Factory::create();
19-
$factory = new React\Dns\Resolver\Factory();
20-
$dns = $factory->create('8.8.8.8', $loop);
21-
22-
$dns->resolve('igor.io')->then(function ($ip) {
23-
echo "Host: $ip\n";
24-
});
25-
26-
$loop->run();
18+
$loop = React\EventLoop\Factory::create();
19+
$factory = new React\Dns\Resolver\Factory();
20+
$dns = $factory->create('8.8.8.8', $loop);
21+
22+
$dns->resolve('igor.io')->then(function ($ip) {
23+
echo "Host: $ip\n";
24+
});
25+
26+
$loop->run();
2727
```
2828

2929
But there's more.
@@ -33,21 +33,21 @@ But there's more.
3333
You can cache results by configuring the resolver to use a `CachedExecutor`:
3434

3535
```php
36-
$loop = React\EventLoop\Factory::create();
37-
$factory = new React\Dns\Resolver\Factory();
38-
$dns = $factory->createCached('8.8.8.8', $loop);
36+
$loop = React\EventLoop\Factory::create();
37+
$factory = new React\Dns\Resolver\Factory();
38+
$dns = $factory->createCached('8.8.8.8', $loop);
39+
40+
$dns->resolve('igor.io')->then(function ($ip) {
41+
echo "Host: $ip\n";
42+
});
3943

40-
$dns->resolve('igor.io')->then(function ($ip) {
41-
echo "Host: $ip\n";
42-
});
44+
...
4345

44-
...
46+
$dns->resolve('igor.io')->then(function ($ip) {
47+
echo "Host: $ip\n";
48+
});
4549

46-
$dns->resolve('igor.io')->then(function ($ip) {
47-
echo "Host: $ip\n";
48-
});
49-
50-
$loop->run();
50+
$loop->run();
5151
```
5252

5353
If the first call returns before the second, only one query will be executed.

0 commit comments

Comments
 (0)