1
0
mirror of https://github.com/danog/amp.git synced 2025-01-23 05:41:25 +01:00
amp/lib/Internal/WrappedCancellationToken.php

37 lines
661 B
PHP
Raw Normal View History

<?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();
}
}