-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.php
More file actions
30 lines (23 loc) · 785 Bytes
/
main.php
File metadata and controls
30 lines (23 loc) · 785 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
30
<?php
declare(strict_types=1);
use Arcp\Client\ARCPClient;
use Arcp\Runtime\JobContext;
require __DIR__ . '/../../vendor/autoload.php';
/** @return array<string, string> */
function buildReport(JobContext $ctx): array
{
$ctx->emitResultChunk('res_report', 'alpha, ');
$ctx->emitResultChunk('res_report', 'beta', more: false);
return ['result_id' => 'res_report'];
}
function elidedClient(): ARCPClient
{
throw new RuntimeException('client setup elided');
}
$client = elidedClient();
$result = $client->invokeTool('reporter');
$value = $result->value;
$resultId = is_array($value) ? ($value['result_id'] ?? null) : null;
if (is_string($resultId) && $client->resultChunks->isComplete($resultId)) {
printf("%s\n", $client->resultChunks->assemble($resultId));
}