2016-08-22 06:40:48 +02:00
|
|
|
<?php declare(strict_types = 1);
|
2016-08-21 17:33:39 +02:00
|
|
|
|
2016-08-23 23:47:40 +02:00
|
|
|
namespace Amp\Parallel\Worker\Internal;
|
2016-08-21 17:33:39 +02:00
|
|
|
|
|
|
|
use Amp\Success;
|
2016-11-15 00:43:44 +01:00
|
|
|
use Interop\Async\Promise;
|
2016-08-21 17:33:39 +02:00
|
|
|
|
2016-09-07 18:38:46 +02:00
|
|
|
class TaskSuccess extends TaskResult {
|
2016-08-21 17:33:39 +02:00
|
|
|
/** @var mixed Result of task. */
|
|
|
|
private $result;
|
|
|
|
|
|
|
|
public function __construct(string $id, $result) {
|
2016-09-07 18:38:46 +02:00
|
|
|
parent::__construct($id);
|
2016-08-21 17:33:39 +02:00
|
|
|
$this->result = $result;
|
|
|
|
}
|
|
|
|
|
2016-11-15 00:43:44 +01:00
|
|
|
public function promise(): Promise {
|
2016-08-21 17:33:39 +02:00
|
|
|
return new Success($this->result);
|
|
|
|
}
|
|
|
|
}
|