Skip to content

Commit 3877888

Browse files
committed
Merge pull request #9 from clue-labs/example
Improve directy listing example
2 parents e2e6269 + 8a82b47 commit 3877888

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

examples/directory.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
$url = 'https://svn.apache.org/viewvc/';
1010
$path = isset($argv[1]) ? $argv[1] : '/';
11+
$revision = isset($argv[2]) ? $argv[2] : null;
1112

1213
$loop = LoopFactory::create();
1314

@@ -27,6 +28,10 @@
2728

2829
$client = new Client($url, $browser);
2930

30-
$client->fetchDirectory($path)->then('var_dump', 'var_dump');
31+
if (substr($path, -1) === '/') {
32+
$client->fetchDirectory($path, $revision)->then('var_dump', 'printf');
33+
} else {
34+
$client->fetchFile($path, $revision)->then('printf', 'printf');
35+
}
3136

3237
$loop->run();

0 commit comments

Comments
 (0)