-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparse-timers.php
More file actions
executable file
·29 lines (23 loc) · 965 Bytes
/
Copy pathparse-timers.php
File metadata and controls
executable file
·29 lines (23 loc) · 965 Bytes
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
#!/usr/bin/env php
<?php
declare(strict_types=1);
require __DIR__ . '/../vendor/autoload.php';
use ProPresenter\Parser\TimersFileReader;
if ($argc < 2) {
echo "Usage: parse-timers.php <Timers>\n";
exit(1);
}
try {
$library = TimersFileReader::read($argv[1]);
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage() . "\n";
exit(1);
}
$timers = $library->getTimers();
echo 'Timers (' . count($timers) . ') clock=' . $library->getClockFormat() . ":\n";
foreach ($timers as $index => $timer) {
$type = $timer->isCountdown() ? 'countdown' : ($timer->isCountdownToTime() ? 'countdown_to_time' : ($timer->isElapsedTime() ? 'elapsed_time' : 'unknown'));
$duration = $timer->getDurationSeconds();
$durationPart = $duration === null ? '' : sprintf(' :: %ds', $duration);
echo sprintf(" [%d] %s :: %s :: %s%s\n", $index + 1, $timer->getName() === '' ? '(unnamed)' : $timer->getName(), $timer->getUuid(), $type, $durationPart);
}