schneespur/release/schneespur-1.0.2/vendor/laravel/prompts/playground/progress.php
Michael 7288b93500 Release v1.0.2: diagnostic infrastructure core
Add neutral diagnostic framework for future reporting modules:
- DiagnosticReporterInterface, Registry, Manager, PayloadSanitizer
- Laravel exception hook in bootstrap/app.php
- Module permission declarations (requires_permissions in module.json)
- Core diagnostic report points (module boot/install/update failures)
- Module documentation update (moduldoku.md)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-18 16:54:11 +00:00

57 lines
1.2 KiB
PHP

<?php
use function Laravel\Prompts\progress;
require __DIR__.'/../vendor/autoload.php';
$states = [
'Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', 'Colorado',
'Connecticut', 'Delaware', 'Florida', 'Georgia', 'Hawaii', 'Idaho',
];
progress(
label: 'Adding States',
steps: $states,
callback: function ($item, $progress) {
usleep(250_000);
if ($item === 'Arkansas') {
$progress->label = 'Arkansas is not a state! Nice try.';
}
return $item.' added.';
},
);
progress(
label: 'Adding States With Label',
steps: $states,
callback: function ($item, $progress) {
usleep(250_000);
$progress
->label('Adding '.$item)
->hint("{$item} has ".strlen($item).' characters');
},
);
$progress = progress(
label: 'Adding States Manually',
steps: $states,
);
$progress->start();
foreach ($states as $state) {
usleep(250_000);
$progress
->hint($state)
->advance();
}
$progress->finish();
progress(
'Processing with Exception',
$states,
fn ($item) => $item === 'Arkansas' ? throw new Exception('Issue with Arkansas!') : usleep(250_000),
);