Skip to content

Commit 360903b

Browse files
committed
Documentation for examples
1 parent e8633d7 commit 360903b

4 files changed

Lines changed: 10 additions & 8 deletions

File tree

examples/copy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
$tar = new Decoder();
2626

27-
// use caret notation for any control characters expect \t, \r and \n
27+
// use caret notation for any control characters except \t, \r and \n
2828
$caret = new Encoder("\t\r\n");
2929

3030
$tar->on('entry', function ($header, ReadableStreamInterface $file) use ($caret) {

examples/info.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
// this simple example displays system wide information from Docker as a simple JSON
23

34
require __DIR__ . '/../vendor/autoload.php';
45

@@ -10,6 +11,8 @@
1011
$factory = new Factory($loop);
1112
$client = $factory->createClient();
1213

13-
$client->info()->then('var_dump', 'var_dump');
14+
$client->info()->then(function ($info) {
15+
echo json_encode($info, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . PHP_EOL;
16+
}, 'printf');
1417

1518
$loop->run();

examples/push.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,8 @@
1616
$factory = new Factory($loop);
1717
$client = $factory->createClient();
1818

19-
$client->imagePush($image, null, null, $auth)->then(
20-
function ($response) {
21-
echo 'response: ' . json_encode($response) . PHP_EOL;
22-
},
23-
'var_dump'
24-
);
19+
$client->imagePush($image, null, null, $auth)->then(function ($result) {
20+
echo json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . PHP_EOL;
21+
}, 'printf');
2522

2623
$loop->run();

examples/resize.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<?php
2+
// this example tries to adjust the TTY size of the given container to 10x10.
3+
// you can check this via "docker logs".
24

35
require __DIR__ . '/../vendor/autoload.php';
46

0 commit comments

Comments
 (0)