1
0
mirror of https://github.com/danog/parallel.git synced 2024-12-03 10:07:49 +01:00
parallel/test/Worker/TestTask.php
Aaron Piotrowski b654463339
Fix code style
2018-10-07 09:50:45 -05:00

29 lines
566 B
PHP

<?php
namespace Amp\Parallel\Test\Worker;
use Amp\Delayed;
use Amp\Parallel\Worker\Environment;
use Amp\Parallel\Worker\Task;
class TestTask implements Task
{
private $returnValue;
private $delay = 0;
public function __construct($returnValue, int $delay = 0)
{
$this->returnValue = $returnValue;
$this->delay = $delay;
}
public function run(Environment $environment)
{
if ($this->delay) {
return new Delayed($this->delay, $this->returnValue);
}
return $this->returnValue;
}
}