-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparse-test-patterns.php
More file actions
34 lines (25 loc) · 1.17 KB
/
Copy pathparse-test-patterns.php
File metadata and controls
34 lines (25 loc) · 1.17 KB
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
#!/usr/bin/env php
<?php
declare(strict_types=1);
require __DIR__ . '/../vendor/autoload.php';
use ProPresenter\Parser\TestPatternsFileReader;
if ($argc < 2) {
echo "Usage: parse-test-patterns.php <TestPatterns>\n";
exit(1);
}
$filePath = $argv[1];
try {
$library = TestPatternsFileReader::read($filePath);
} catch (Exception $e) {
echo "Error: " . $e->getMessage() . "\n";
exit(1);
}
echo "TestPatterns (" . $library->count() . "):\n";
echo sprintf(" State: selected=%s :: name=%s :: display_location=%d :: screen=%s\n", $library->getSelectedPatternUuid() === '' ? '(none)' : $library->getSelectedPatternUuid(), $library->getSelectedPatternNameLocalizationKey() === '' ? '(none)' : $library->getSelectedPatternNameLocalizationKey(), $library->getDisplayLocation(), $library->getSpecificScreenUuid() === '' ? '(none)' : $library->getSpecificScreenUuid());
foreach ($library->getPatterns() as $index => $pattern) {
$number = $index + 1;
$name = $pattern->getNameLocalizationKey();
$displayName = $name === '' ? '(unnamed)' : $name;
$uuid = $pattern->getUuid()?->getString() ?? '';
echo sprintf(" [%d] %s :: %s\n", $number, $displayName, $uuid);
}