-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsimple.php
100 lines (69 loc) · 1.78 KB
/
simple.php
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<?php
/*
* This file is part of aeno/php-slickprogress.
* (c) Steffen Rieke <dev@aenogym.de>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
declare(strict_types=1);
use Aeno\SlickProgress\Progress;
use Aeno\SlickProgress\Theme\Simple;
require __DIR__.'/../vendor/autoload.php';
echo 'SIMPLE --------------'.PHP_EOL;
$progress = new Progress();
$progress->start(50);
for ($i=0;$i<50;$i++) {
$progress->advance();
usleep(25000);
}
$progress->finish();
echo PHP_EOL;
echo 'SIMPLE WITH STATUS --------------'.PHP_EOL;
$theme = new Simple();
$progress = new Progress($theme);
$progress->start(200);
for ($i=0;$i<200;$i++) {
if ($i % 25 === 0) {
$progress->setStatusMessage("Status Message - \$i === $i");
}
$progress->advance();
usleep(25000);
}
$progress->finish();
echo PHP_EOL;
echo 'SIMPLE INDEFINITE --------------'.PHP_EOL;
$progress = new Progress();
$progress->start(-1);
for ($i=0;$i<200;$i++) {
$progress->advance();
usleep(25000);
}
$progress->finish();
echo PHP_EOL;
echo 'SIMPLE WITH LABELS --------------'.PHP_EOL;
$theme = new Simple();
$theme->showStep(true);
$theme->showPercent(true);
$progress = new Progress($theme);
$progress->start(200);
for ($i=0;$i<200;$i++) {
$progress->advance();
usleep(25000);
}
$progress->finish();
echo PHP_EOL;
echo 'SIMPLE INDEFINITE WITH LABELS --------------'.PHP_EOL;
$theme = new Simple();
$theme->showStep(true);
$theme->showPercent(true);
$progress = new Progress($theme);
$progress->start(-1);
for ($i=0;$i<200;$i++) {
$progress->advance();
usleep(25000);
}
$progress->finish();
echo PHP_EOL;
echo 'DONE!'.PHP_EOL;