1 | <?php |
||
7 | class OutstandingCall |
||
8 | { |
||
9 | /** |
||
10 | * @var string |
||
11 | */ |
||
12 | protected $uniqid; |
||
13 | |||
14 | /** |
||
15 | * @var Deferred |
||
16 | */ |
||
17 | protected $deferred; |
||
18 | |||
19 | /** |
||
20 | * @var callable |
||
21 | */ |
||
22 | protected $cleanup; |
||
23 | |||
24 | /** |
||
25 | * @param string $uniqid |
||
26 | * @param callable $canceller |
||
27 | */ |
||
28 | 4 | public function __construct($uniqid, callable $canceller = null, callable $cleanup = null) |
|
29 | { |
||
30 | 4 | if ($canceller !== null) { |
|
31 | 3 | $canceller = \Closure::bind($canceller, $this, 'WyriHaximus\React\ChildProcess\Messenger\OutstandingCall'); |
|
32 | } |
||
33 | |||
34 | 4 | $this->uniqid = $uniqid; |
|
35 | 4 | $this->deferred = new Deferred($canceller); |
|
36 | |||
37 | 4 | if (!is_callable($cleanup)) { |
|
38 | 1 | $cleanup = function () { |
|
39 | 1 | }; |
|
40 | } |
||
41 | 4 | $this->cleanup = $cleanup; |
|
42 | 4 | } |
|
43 | |||
44 | /** |
||
45 | * @return mixed |
||
46 | */ |
||
47 | 4 | public function getUniqid() |
|
51 | |||
52 | /** |
||
53 | * @return Deferred |
||
54 | */ |
||
55 | 3 | public function getDeferred() |
|
59 | |||
60 | /** |
||
61 | * @param mixed $value |
||
62 | */ |
||
63 | 1 | public function resolve($value) |
|
64 | { |
||
65 | 1 | $cleanup = $this->cleanup; |
|
66 | 1 | $cleanup($this); |
|
67 | 1 | return $this->deferred->resolve($value); |
|
68 | } |
||
69 | |||
70 | /** |
||
71 | * @param mixed $value |
||
72 | */ |
||
73 | public function progress($value) |
||
79 | |||
80 | /** |
||
81 | * @param mixed $value |
||
82 | */ |
||
83 | public function reject($value) |
||
89 | } |
||
90 |
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.