File: Thennable.php

package info (click to toggle)
php-guzzlehttp-promises 2.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 484 kB
  • sloc: php: 3,208; makefile: 24; xml: 23
file content (27 lines) | stat: -rw-r--r-- 477 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php

declare(strict_types=1);

namespace GuzzleHttp\Promise\Tests;

use GuzzleHttp\Promise\Promise;

class Thennable
{
    private $nextPromise;

    public function __construct()
    {
        $this->nextPromise = new Promise();
    }

    public function then(?callable $res = null, ?callable $rej = null)
    {
        return $this->nextPromise->then($res, $rej);
    }

    public function resolve($value): void
    {
        $this->nextPromise->resolve($value);
    }
}