mirror of
https://github.com/danog/parallel.git
synced 2024-12-02 17:52:14 +01:00
28 lines
571 B
PHP
28 lines
571 B
PHP
<?php declare(strict_types = 1);
|
|
|
|
namespace Amp\Parallel\Worker\Internal;
|
|
|
|
use Amp\Success;
|
|
use Interop\Async\Awaitable;
|
|
|
|
class TaskSuccess implements TaskResult {
|
|
/** @var string */
|
|
private $id;
|
|
|
|
/** @var mixed Result of task. */
|
|
private $result;
|
|
|
|
public function __construct(string $id, $result) {
|
|
$this->id = $id;
|
|
$this->result = $result;
|
|
}
|
|
|
|
public function getId(): string {
|
|
return $this->id;
|
|
}
|
|
|
|
public function getAwaitable(): Awaitable {
|
|
return new Success($this->result);
|
|
}
|
|
}
|