mirror of
https://github.com/danog/amp.git
synced 2025-01-22 21:31:18 +01:00
37 lines
661 B
PHP
37 lines
661 B
PHP
<?php
|
|
|
|
namespace Amp\Internal;
|
|
|
|
use Amp\CancellationToken;
|
|
|
|
/**
|
|
* @internal
|
|
*/
|
|
final class WrappedCancellationToken implements CancellationToken
|
|
{
|
|
public function __construct(
|
|
private CancellationToken $token
|
|
) {
|
|
}
|
|
|
|
public function subscribe(callable $callback): string
|
|
{
|
|
return $this->token->subscribe($callback);
|
|
}
|
|
|
|
public function unsubscribe(string $id): void
|
|
{
|
|
$this->token->unsubscribe($id);
|
|
}
|
|
|
|
public function isRequested(): bool
|
|
{
|
|
return $this->token->isRequested();
|
|
}
|
|
|
|
public function throwIfRequested(): void
|
|
{
|
|
$this->token->throwIfRequested();
|
|
}
|
|
}
|