2016-12-29 19:16:04 -06:00
|
|
|
<?php
|
2016-08-21 10:33:39 -05:00
|
|
|
|
2016-08-23 16:47:40 -05:00
|
|
|
namespace Amp\Parallel\Worker\Internal;
|
2016-08-21 10:33:39 -05:00
|
|
|
|
2017-03-16 17:03:59 -05:00
|
|
|
use Amp\Promise;
|
2016-08-21 10:33:39 -05:00
|
|
|
|
2017-07-27 23:49:20 -05:00
|
|
|
/** @internal */
|
2018-10-07 09:50:45 -05:00
|
|
|
abstract class TaskResult
|
|
|
|
{
|
2016-09-07 11:38:46 -05:00
|
|
|
/** @var string Task identifier. */
|
|
|
|
private $id;
|
2017-05-18 09:51:31 +02:00
|
|
|
|
2016-09-07 11:38:46 -05:00
|
|
|
/**
|
|
|
|
* @param string $id Task identifier.
|
|
|
|
*/
|
2018-10-07 09:50:45 -05:00
|
|
|
public function __construct(string $id)
|
|
|
|
{
|
2016-09-07 11:38:46 -05:00
|
|
|
$this->id = $id;
|
|
|
|
}
|
2017-05-18 09:51:31 +02:00
|
|
|
|
2016-08-21 10:33:39 -05:00
|
|
|
/**
|
|
|
|
* @return string Task identifier.
|
|
|
|
*/
|
2018-10-07 09:50:45 -05:00
|
|
|
public function getId(): string
|
|
|
|
{
|
2016-09-07 11:38:46 -05:00
|
|
|
return $this->id;
|
|
|
|
}
|
2017-05-18 09:51:31 +02:00
|
|
|
|
2016-08-21 10:33:39 -05:00
|
|
|
/**
|
2017-03-16 17:03:59 -05:00
|
|
|
* @return \Amp\Promise<mixed> Resolved with the task result or failure reason.
|
2016-08-21 10:33:39 -05:00
|
|
|
*/
|
2016-11-14 17:43:44 -06:00
|
|
|
abstract public function promise(): Promise;
|
2017-05-18 09:51:31 +02:00
|
|
|
}
|