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
|
|
|
|
2016-09-07 11:38:46 -05:00
|
|
|
abstract class TaskResult {
|
|
|
|
/** @var string Task identifier. */
|
|
|
|
private $id;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string $id Task identifier.
|
|
|
|
*/
|
|
|
|
public function __construct(string $id) {
|
|
|
|
$this->id = $id;
|
|
|
|
}
|
|
|
|
|
2016-08-21 10:33:39 -05:00
|
|
|
/**
|
|
|
|
* @return string Task identifier.
|
|
|
|
*/
|
2016-09-07 11:38:46 -05:00
|
|
|
public function getId(): string {
|
|
|
|
return $this->id;
|
|
|
|
}
|
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;
|
2016-08-21 10:33:39 -05:00
|
|
|
}
|