php-ipc/src/Interop/Async/Promise.php

21 lines
270 B
PHP

<?php
namespace NoccyLabs\Ipc\Interop\Async;
class Promise
{
private $then;
public function then(callable $then)
{
$this->then = $then;
}
public function invoke(...$args)
{
call_user_func($this->then, ...$args);
}
}