Skip to content

Commit 53be8cb

Browse files
committed
Create AsyncTaskStatus.php
1 parent f0de38d commit 53be8cb

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

src/AsyncTaskStatus.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Vectorial1024\LaravelProcessAsync;
6+
7+
use RuntimeException;
8+
9+
/**
10+
* Represents the status of an async task: "running" or "stopped".
11+
*
12+
* This does not tell you whether it was a success/failure, since it depends on the user's custom result checking.
13+
*/
14+
class AsyncTaskStatus
15+
{
16+
/**
17+
* Constructs a status object.
18+
* @param string $taskID The task ID of the async task so to check its status.
19+
*/
20+
public function __construct(
21+
public readonly string $taskID
22+
) {
23+
if ($taskID === "") {
24+
// why no blank IDs? because this will produce blank output via base64 encode.
25+
throw new RuntimeException("AsyncTask IDs cannot be blank");
26+
}
27+
}
28+
}

0 commit comments

Comments
 (0)