This repository was archived by the owner on Jan 6, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +9
-26
lines changed Expand file tree Collapse file tree 2 files changed +9
-26
lines changed Original file line number Diff line number Diff line change 16
16
],
17
17
"require" : {
18
18
"php" : " >=5.5.0" ,
19
- "php-http/httplug" : " ^ 1.0@dev " ,
19
+ "php-http/httplug" : " 1.0.0-alpha3 " ,
20
20
"php-http/client-tools" : " ^0.1@dev" ,
21
21
"guzzlehttp/guzzle" : " ^6.0"
22
22
},
Original file line number Diff line number Diff line change 5
5
use GuzzleHttp \Exception as GuzzleExceptions ;
6
6
use GuzzleHttp \Promise \PromiseInterface ;
7
7
use Http \Client \Exception as HttplugException ;
8
- use Http \Client \Promise ;
8
+ use Http \Promise \Promise ;
9
9
use Psr \Http \Message \RequestInterface ;
10
10
use Psr \Http \Message \ResponseInterface ;
11
11
@@ -89,37 +89,20 @@ public function getState()
89
89
return $ this ->state ;
90
90
}
91
91
92
-
93
92
/**
94
93
* {@inheritdoc}
95
94
*/
96
- public function getResponse ( )
95
+ public function wait ( $ unwrap = true )
97
96
{
98
- if (self ::FULFILLED !== $ this ->state ) {
99
- throw new \LogicException ("Response not available for the current state " );
100
- }
97
+ $ this ->promise ->wait (false );
101
98
102
- return $ this ->response ;
103
- }
99
+ if ($ unwrap ) {
100
+ if ($ this ->getState () == self ::REJECTED ) {
101
+ throw $ this ->exception ;
102
+ }
104
103
105
- /**
106
- * {@inheritdoc}
107
- */
108
- public function getException ()
109
- {
110
- if (self ::REJECTED !== $ this ->state ) {
111
- throw new \LogicException ("Error not available for the current state " );
104
+ return $ this ->response ;
112
105
}
113
-
114
- return $ this ->exception ;
115
- }
116
-
117
- /**
118
- * {@inheritdoc}
119
- */
120
- public function wait ()
121
- {
122
- $ this ->promise ->wait (false );
123
106
}
124
107
125
108
/**
You can’t perform that action at this time.
0 commit comments