parallel/lib/Worker/Internal/TaskSuccess.php

22 lines
420 B
PHP
Raw Normal View History

2016-12-29 19:16:04 -06:00
<?php
2016-08-23 16:47:40 -05:00
namespace Amp\Parallel\Worker\Internal;
use Amp\Promise;
2017-05-18 09:51:31 +02:00
use Amp\Success;
2017-07-27 23:49:20 -05:00
/** @internal */
2016-09-07 11:38:46 -05:00
class TaskSuccess extends TaskResult {
/** @var mixed Result of task. */
private $result;
2017-05-18 09:51:31 +02:00
public function __construct(string $id, $result) {
2016-09-07 11:38:46 -05:00
parent::__construct($id);
$this->result = $result;
}
2017-05-18 09:51:31 +02:00
2016-11-14 17:43:44 -06:00
public function promise(): Promise {
return new Success($this->result);
}
}