Files
apimacro/vendor/guzzlehttp/promises/src/Is.php

41 lines
941 B
PHP
Raw Normal View History

2024-05-07 12:17:25 +02:00
<?php
2024-05-17 12:24:19 +00:00
declare(strict_types=1);
2024-05-07 12:17:25 +02:00
namespace GuzzleHttp\Promise;
final class Is
{
/**
* Returns true if a promise is pending.
*/
2024-05-17 12:24:19 +00:00
public static function pending(PromiseInterface $promise): bool
2024-05-07 12:17:25 +02:00
{
return $promise->getState() === PromiseInterface::PENDING;
}
/**
* Returns true if a promise is fulfilled or rejected.
*/
2024-05-17 12:24:19 +00:00
public static function settled(PromiseInterface $promise): bool
2024-05-07 12:17:25 +02:00
{
return $promise->getState() !== PromiseInterface::PENDING;
}
/**
* Returns true if a promise is fulfilled.
*/
2024-05-17 12:24:19 +00:00
public static function fulfilled(PromiseInterface $promise): bool
2024-05-07 12:17:25 +02:00
{
return $promise->getState() === PromiseInterface::FULFILLED;
}
/**
* Returns true if a promise is rejected.
*/
2024-05-17 12:24:19 +00:00
public static function rejected(PromiseInterface $promise): bool
2024-05-07 12:17:25 +02:00
{
return $promise->getState() === PromiseInterface::REJECTED;
}
}