diff options
Diffstat (limited to 'vendor/guzzlehttp/promises/src/Is.php')
-rw-r--r-- | vendor/guzzlehttp/promises/src/Is.php | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/vendor/guzzlehttp/promises/src/Is.php b/vendor/guzzlehttp/promises/src/Is.php new file mode 100644 index 0000000..c3ed8d0 --- /dev/null +++ b/vendor/guzzlehttp/promises/src/Is.php @@ -0,0 +1,46 @@ +<?php + +namespace GuzzleHttp\Promise; + +final class Is +{ + /** + * Returns true if a promise is pending. + * + * @return bool + */ + public static function pending(PromiseInterface $promise) + { + return $promise->getState() === PromiseInterface::PENDING; + } + + /** + * Returns true if a promise is fulfilled or rejected. + * + * @return bool + */ + public static function settled(PromiseInterface $promise) + { + return $promise->getState() !== PromiseInterface::PENDING; + } + + /** + * Returns true if a promise is fulfilled. + * + * @return bool + */ + public static function fulfilled(PromiseInterface $promise) + { + return $promise->getState() === PromiseInterface::FULFILLED; + } + + /** + * Returns true if a promise is rejected. + * + * @return bool + */ + public static function rejected(PromiseInterface $promise) + { + return $promise->getState() === PromiseInterface::REJECTED; + } +} |