1<?php
2
3namespace React\Promise\PromiseAdapter;
4
5use React\Promise;
6
7class CallbackPromiseAdapter implements PromiseAdapterInterface
8{
9    private $callbacks;
10
11    public function __construct(array $callbacks)
12    {
13        $this->callbacks = $callbacks;
14    }
15
16    public function promise()
17    {
18        return call_user_func_array($this->callbacks['promise'], func_get_args());
19    }
20
21    public function resolve()
22    {
23        return call_user_func_array($this->callbacks['resolve'], func_get_args());
24    }
25
26    public function reject()
27    {
28        return call_user_func_array($this->callbacks['reject'], func_get_args());
29    }
30
31    public function notify()
32    {
33        return call_user_func_array($this->callbacks['notify'], func_get_args());
34    }
35
36    public function settle()
37    {
38        return call_user_func_array($this->callbacks['settle'], func_get_args());
39    }
40}
41