2016-12-30 02:16:04 +01:00
|
|
|
<?php
|
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
|
|
|
|
2017-03-16 23:03:59 +01:00
|
|
|
use Amp\Promise;
|
2016-08-21 17:33:39 +02:00
|
|
|
|
2017-07-28 06:49:20 +02:00
|
|
|
/** @internal */
|
2016-09-07 18:38:46 +02:00
|
|
|
abstract class TaskResult {
|
|
|
|
/** @var string Task identifier. */
|
|
|
|
private $id;
|
2017-05-18 09:51:31 +02:00
|
|
|
|
2016-09-07 18:38:46 +02:00
|
|
|
/**
|
|
|
|
* @param string $id Task identifier.
|
|
|
|
*/
|
|
|
|
public function __construct(string $id) {
|
|
|
|
$this->id = $id;
|
|
|
|
}
|
2017-05-18 09:51:31 +02:00
|
|
|
|
2016-08-21 17:33:39 +02:00
|
|
|
/**
|
|
|
|
* @return string Task identifier.
|
|
|
|
*/
|
2016-09-07 18:38:46 +02:00
|
|
|
public function getId(): string {
|
|
|
|
return $this->id;
|
|
|
|
}
|
2017-05-18 09:51:31 +02:00
|
|
|
|
2016-08-21 17:33:39 +02:00
|
|
|
/**
|
2017-03-16 23:03:59 +01:00
|
|
|
* @return \Amp\Promise<mixed> Resolved with the task result or failure reason.
|
2016-08-21 17:33:39 +02:00
|
|
|
*/
|
2016-11-15 00:43:44 +01:00
|
|
|
abstract public function promise(): Promise;
|
2017-05-18 09:51:31 +02:00
|
|
|
}
|