allow vendord
All checks were successful
Build, Push and Deploy / build-and-push (push) Successful in 3m3s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 16s
Build, Push and Deploy / deploy-staging (push) Successful in 32s
Build, Push and Deploy / deploy-production (push) Has been skipped
Build, Push and Deploy / cleanup (push) Successful in 1s
All checks were successful
Build, Push and Deploy / build-and-push (push) Successful in 3m3s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 16s
Build, Push and Deploy / deploy-staging (push) Successful in 32s
Build, Push and Deploy / deploy-production (push) Has been skipped
Build, Push and Deploy / cleanup (push) Successful in 1s
This commit is contained in:
51
vendor/php-http/promise/src/FulfilledPromise.php
vendored
Normal file
51
vendor/php-http/promise/src/FulfilledPromise.php
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace Http\Promise;
|
||||
|
||||
/**
|
||||
* A promise already fulfilled.
|
||||
*
|
||||
* @author Joel Wurtz <joel.wurtz@gmail.com>
|
||||
*/
|
||||
final class FulfilledPromise implements Promise
|
||||
{
|
||||
/**
|
||||
* @var mixed
|
||||
*/
|
||||
private $result;
|
||||
|
||||
/**
|
||||
* @param mixed $result
|
||||
*/
|
||||
public function __construct($result)
|
||||
{
|
||||
$this->result = $result;
|
||||
}
|
||||
|
||||
public function then(?callable $onFulfilled = null, ?callable $onRejected = null)
|
||||
{
|
||||
if (null === $onFulfilled) {
|
||||
return $this;
|
||||
}
|
||||
|
||||
try {
|
||||
return new self($onFulfilled($this->result));
|
||||
} catch (\Exception $e) {
|
||||
return new RejectedPromise($e);
|
||||
}
|
||||
}
|
||||
|
||||
public function getState()
|
||||
{
|
||||
return Promise::FULFILLED;
|
||||
}
|
||||
|
||||
public function wait($unwrap = true)
|
||||
{
|
||||
if ($unwrap) {
|
||||
return $this->result;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user