aboutsummaryrefslogtreecommitdiffhomepage
path: root/assets/php/vendor/react/promise/tests/PromiseAdapter/CallbackPromiseAdapter.php
blob: bdedf4658e455eac097fe41325d1e0a3e45c4d5b (plain) (blame)
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
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php

namespace React\Promise\PromiseAdapter;

use React\Promise;

class CallbackPromiseAdapter implements PromiseAdapterInterface
{
    private $callbacks;

    public function __construct(array $callbacks)
    {
        $this->callbacks = $callbacks;
    }

    public function promise()
    {
        return call_user_func_array($this->callbacks['promise'], func_get_args());
    }

    public function resolve()
    {
        return call_user_func_array($this->callbacks['resolve'], func_get_args());
    }

    public function reject()
    {
        return call_user_func_array($this->callbacks['reject'], func_get_args());
    }

    public function notify()
    {
        return call_user_func_array($this->callbacks['notify'], func_get_args());
    }

    public function settle()
    {
        return call_user_func_array($this->callbacks['settle'], func_get_args());
    }
}